Remove the Reader and Writer
@@ -22,8 +22,6 @@ public final class RSBlocks {
|
||||
public static final BlockNetworkReceiver NETWORK_RECEIVER = new BlockNetworkReceiver();
|
||||
public static final BlockFluidInterface FLUID_INTERFACE = new BlockFluidInterface();
|
||||
public static final BlockDiskManipulator DISK_MANIPULATOR = new BlockDiskManipulator();
|
||||
public static final BlockReader READER = new BlockReader();
|
||||
public static final BlockWriter WRITER = new BlockWriter();
|
||||
public static final BlockSecurityManager SECURITY_MANAGER = new BlockSecurityManager();
|
||||
|
||||
@ObjectHolder(RS.ID + ":quartz_enriched_iron_block")
|
||||
|
@@ -47,8 +47,6 @@ public final class RSContainers {
|
||||
public static final ContainerType<ImporterContainer> INTERFACE = null;
|
||||
//@ObjectHolder(RS.ID + ":network_transmitter")
|
||||
public static final ContainerType<NetworkTransmitterContainer> NETWORK_TRANSMITTER = null;
|
||||
//@ObjectHolder(RS.ID + ":reader_writer")
|
||||
public static final ContainerType<ReaderWriterContainer> READER_WRITER = null;
|
||||
//@ObjectHolder(RS.ID + ":relay")
|
||||
public static final ContainerType<RelayContainer> RELAY = null;
|
||||
//@ObjectHolder(RS.ID + ":security_manager")
|
||||
|
@@ -57,12 +57,6 @@ public class RSOldConfig {
|
||||
public int wirelessCraftingMonitorCancelAllUsage;
|
||||
//endregion
|
||||
|
||||
//region Readers and Writers
|
||||
public int readerUsage;
|
||||
public int writerUsage;
|
||||
public int readerWriterChannelEnergyCapacity;
|
||||
//endregion
|
||||
|
||||
//region Autocrafting
|
||||
public int calculationTimeoutMs;
|
||||
//endregion
|
||||
@@ -74,7 +68,6 @@ public class RSOldConfig {
|
||||
private static final String PORTABLE_GRID = "portableGrid";
|
||||
private static final String WIRELESS_FLUID_GRID = "wirelessFluidGrid";
|
||||
private static final String WIRELESS_CRAFTING_MONITOR = "wirelessCraftingMonitor";
|
||||
private static final String READER_WRITER = "readerWriter";
|
||||
private static final String AUTOCRAFTING = "autocrafting";
|
||||
//endregion
|
||||
|
||||
@@ -135,12 +128,6 @@ public class RSOldConfig {
|
||||
wirelessCraftingMonitorCancelAllUsage = config.getInt("cancelAll", WIRELESS_CRAFTING_MONITOR, 5, 0, Integer.MAX_VALUE, "The energy used by the Wireless Crafting Monitor to cancel all tasks");
|
||||
//endregion
|
||||
|
||||
//region Readers and Writers
|
||||
readerUsage = config.getInt("reader", READER_WRITER, 2, 0, Integer.MAX_VALUE, "The energy used by Readers");
|
||||
writerUsage = config.getInt("writer", READER_WRITER, 2, 0, Integer.MAX_VALUE, "The energy used by Writers");
|
||||
readerWriterChannelEnergyCapacity = config.getInt("channelEnergyCapacity", READER_WRITER, 16000, 0, Integer.MAX_VALUE, "The energy capacity of energy channels");
|
||||
//endregion
|
||||
|
||||
//region Autocrafting
|
||||
calculationTimeoutMs = config.getInt("calculationTimeoutMs", AUTOCRAFTING, 5000, 5000, Integer.MAX_VALUE, "The autocrafting calculation timeout in milliseconds, tasks taking longer than this to calculate (NOT execute) are cancelled to avoid server strain");
|
||||
//endregion
|
||||
|
@@ -61,10 +61,6 @@ public class RSTiles {
|
||||
public static final TileEntityType<TileNetworkTransmitter> NETWORK_TRANSMITTER = null;
|
||||
//@ObjectHolder(RS.ID + ":network_receiver")
|
||||
public static final TileEntityType<TileNetworkReceiver> NETWORK_RECEIVER = null;
|
||||
//@ObjectHolder(RS.ID + ":reader")
|
||||
public static final TileEntityType<TileReader> READER = null;
|
||||
//@ObjectHolder(RS.ID + ":writer")
|
||||
public static final TileEntityType<TileWriter> WRITER = null;
|
||||
//@ObjectHolder(RS.ID + ":relay")
|
||||
public static final TileEntityType<TileRelay> RELAY = null;
|
||||
//@ObjectHolder(RS.ID + ":security_manager")
|
||||
|
@@ -7,14 +7,11 @@ import com.raoulvdberge.refinedstorage.api.autocrafting.preview.ICraftingPreview
|
||||
import com.raoulvdberge.refinedstorage.api.autocrafting.registry.ICraftingTaskRegistry;
|
||||
import com.raoulvdberge.refinedstorage.api.autocrafting.task.CraftingTaskReadException;
|
||||
import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingRequestInfo;
|
||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||
import com.raoulvdberge.refinedstorage.api.network.grid.ICraftingGridBehavior;
|
||||
import com.raoulvdberge.refinedstorage.api.network.grid.IGridManager;
|
||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
|
||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeManager;
|
||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeRegistry;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterChannel;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterHandlerRegistry;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.StorageType;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDisk;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDiskManager;
|
||||
@@ -84,20 +81,6 @@ public interface IRSAPI {
|
||||
@Nonnull
|
||||
ICraftingPreviewElementRegistry getCraftingPreviewElementRegistry();
|
||||
|
||||
/**
|
||||
* @return the reader writer handler registry
|
||||
*/
|
||||
@Nonnull
|
||||
IReaderWriterHandlerRegistry getReaderWriterHandlerRegistry();
|
||||
|
||||
/**
|
||||
* @param name the name of the channel
|
||||
* @param network the network
|
||||
* @return a new reader writer channel
|
||||
*/
|
||||
@Nonnull
|
||||
IReaderWriterChannel createReaderWriterChannel(String name, INetwork network);
|
||||
|
||||
/**
|
||||
* @return an empty item stack list
|
||||
*/
|
||||
|
@@ -4,7 +4,6 @@ import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingManager;
|
||||
import com.raoulvdberge.refinedstorage.api.network.grid.handler.IFluidGridHandler;
|
||||
import com.raoulvdberge.refinedstorage.api.network.grid.handler.IItemGridHandler;
|
||||
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterManager;
|
||||
import com.raoulvdberge.refinedstorage.api.network.security.ISecurityManager;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.IStorage;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.cache.IStorageCache;
|
||||
@@ -78,11 +77,6 @@ public interface INetwork {
|
||||
*/
|
||||
IStorageCache<FluidStack> getFluidStorageCache();
|
||||
|
||||
/**
|
||||
* @return the {@link IReaderWriterManager} of this network
|
||||
*/
|
||||
IReaderWriterManager getReaderWriterManager();
|
||||
|
||||
/**
|
||||
* Inserts an item in this network.
|
||||
*
|
||||
|
@@ -1,23 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.api.network.readerwriter;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
|
||||
|
||||
/**
|
||||
* Represents a reader network node.
|
||||
*/
|
||||
public interface IReader extends INetworkNode {
|
||||
/**
|
||||
* @return the redstone strength that this reader is receiving
|
||||
*/
|
||||
int getRedstoneStrength();
|
||||
|
||||
/**
|
||||
* @return the channel
|
||||
*/
|
||||
String getChannel();
|
||||
|
||||
/**
|
||||
* @param channel the channel
|
||||
*/
|
||||
void setChannel(String channel);
|
||||
}
|
@@ -1,40 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.api.network.readerwriter;
|
||||
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents a reader writer channel.
|
||||
*/
|
||||
public interface IReaderWriterChannel {
|
||||
/**
|
||||
* @return the handlers that this channel has
|
||||
*/
|
||||
List<IReaderWriterHandler> getHandlers();
|
||||
|
||||
/**
|
||||
* @return a list of readers using this channel
|
||||
*/
|
||||
List<IReader> getReaders();
|
||||
|
||||
/**
|
||||
* @return a list of writers using this channel
|
||||
*/
|
||||
List<IWriter> getWriters();
|
||||
|
||||
/**
|
||||
* Writes this channel to NBT.
|
||||
*
|
||||
* @param tag the tag to write to
|
||||
* @return the written tag
|
||||
*/
|
||||
CompoundNBT writeToNbt(CompoundNBT tag);
|
||||
|
||||
/**
|
||||
* Reads this channel from NBT.
|
||||
*
|
||||
* @param tag the tag to read from
|
||||
*/
|
||||
void readFromNbt(CompoundNBT tag);
|
||||
}
|
@@ -1,87 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.api.network.readerwriter;
|
||||
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents a reader writer handler.
|
||||
* For example: items, fluids, energy, ...
|
||||
*/
|
||||
public interface IReaderWriterHandler {
|
||||
/**
|
||||
* Updates this reader writer handler.
|
||||
*
|
||||
* @param channel the channel this reader writer handler is assigned to
|
||||
*/
|
||||
void update(IReaderWriterChannel channel);
|
||||
|
||||
/**
|
||||
* Called when this handler is removed from a writer.
|
||||
*
|
||||
* @param writer the writer
|
||||
*/
|
||||
void onWriterDisabled(IWriter writer);
|
||||
|
||||
/**
|
||||
* @param reader the reader
|
||||
* @param capability the capability
|
||||
* @return true if we have the given capability for the reader, false otherwise
|
||||
*/
|
||||
boolean hasCapabilityReader(IReader reader, Capability<?> capability);
|
||||
|
||||
/**
|
||||
* @param reader the reader
|
||||
* @param capability the capability
|
||||
* @return the capability for the given reader
|
||||
*/
|
||||
<T> T getCapabilityReader(IReader reader, Capability<T> capability);
|
||||
|
||||
/**
|
||||
* @param writer the writer
|
||||
* @param capability the capability
|
||||
* @return true if we have the given capability for the writer, false otherwise
|
||||
*/
|
||||
boolean hasCapabilityWriter(IWriter writer, Capability<?> capability);
|
||||
|
||||
/**
|
||||
* @param writer the writer
|
||||
* @param capability the capability
|
||||
* @return the capability for the given writer
|
||||
*/
|
||||
<T> T getCapabilityWriter(IWriter writer, Capability<T> capability);
|
||||
|
||||
/**
|
||||
* @return a dummy capability that does nothing, for use client side
|
||||
*/
|
||||
Object getNullCapability();
|
||||
|
||||
/**
|
||||
* Writes this reader writer handler to NBT.
|
||||
*
|
||||
* @param tag the tag to write to
|
||||
* @return the written tag
|
||||
*/
|
||||
CompoundNBT writeToNbt(CompoundNBT tag);
|
||||
|
||||
/**
|
||||
* @return the id of this writer, as assigned to the {@link IReaderWriterHandlerRegistry}
|
||||
*/
|
||||
String getId();
|
||||
|
||||
/**
|
||||
* @param reader the reader
|
||||
* @param channel the channel
|
||||
* @return status line(s) displayed when right clicking a reader
|
||||
*/
|
||||
List<ITextComponent> getStatusReader(IReader reader, IReaderWriterChannel channel);
|
||||
|
||||
/**
|
||||
* @param writer the writer
|
||||
* @param channel the channel
|
||||
* @return status line(s) displayed when right clicking a writer
|
||||
*/
|
||||
List<ITextComponent> getStatusWriter(IWriter writer, IReaderWriterChannel channel);
|
||||
}
|
@@ -1,20 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.api.network.readerwriter;
|
||||
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A factory that is able to create reader writer handlers.
|
||||
*/
|
||||
public interface IReaderWriterHandlerFactory {
|
||||
/**
|
||||
* Creates a reader writer handler (based on NBT tag if there is any).
|
||||
*
|
||||
* @param tag the tag to read from, null if this reader writer handler is created on demand
|
||||
* @return the reader writer handler
|
||||
*/
|
||||
@Nonnull
|
||||
IReaderWriterHandler create(@Nullable CompoundNBT tag);
|
||||
}
|
@@ -1,31 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.api.network.readerwriter;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* A registry for reader writer handler factories.
|
||||
*/
|
||||
public interface IReaderWriterHandlerRegistry {
|
||||
/**
|
||||
* Adds a factory to the registry.
|
||||
*
|
||||
* @param id the id of this reader writer handler, as specified in {@link IReaderWriterHandler#getId()}
|
||||
* @param factory the factory
|
||||
*/
|
||||
void add(String id, IReaderWriterHandlerFactory factory);
|
||||
|
||||
/**
|
||||
* Gets a factory from the registry.
|
||||
*
|
||||
* @param id the id of the factory to get
|
||||
* @return the factory, or null if no factory was found
|
||||
*/
|
||||
@Nullable
|
||||
IReaderWriterHandlerFactory get(String id);
|
||||
|
||||
/**
|
||||
* @return a list of reader writer handler factories
|
||||
*/
|
||||
Collection<IReaderWriterHandlerFactory> all();
|
||||
}
|
@@ -1,16 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.api.network.readerwriter;
|
||||
|
||||
/**
|
||||
* A listener for reader writers.
|
||||
*/
|
||||
public interface IReaderWriterListener {
|
||||
/**
|
||||
* Called when the listener is attached.
|
||||
*/
|
||||
void onAttached();
|
||||
|
||||
/**
|
||||
* Called when a reader writer channel has changed.
|
||||
*/
|
||||
void onChanged();
|
||||
}
|
@@ -1,66 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.api.network.readerwriter;
|
||||
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* A manager for the reader writer.
|
||||
*/
|
||||
public interface IReaderWriterManager {
|
||||
/**
|
||||
* Updates the channels.
|
||||
*/
|
||||
void update();
|
||||
|
||||
/**
|
||||
* @param name the name of the channel
|
||||
* @return the channel, or null if nothing was found
|
||||
*/
|
||||
@Nullable
|
||||
IReaderWriterChannel getChannel(String name);
|
||||
|
||||
/**
|
||||
* Adds a new channel.
|
||||
*
|
||||
* @param name the name of this channel
|
||||
*/
|
||||
void addChannel(String name);
|
||||
|
||||
/**
|
||||
* Removes a channel.
|
||||
*
|
||||
* @param name the name of the channel to remove
|
||||
*/
|
||||
void removeChannel(String name);
|
||||
|
||||
/**
|
||||
* @return a collection of channels
|
||||
*/
|
||||
Collection<String> getChannels();
|
||||
|
||||
/**
|
||||
* Adds a listener.
|
||||
*
|
||||
* @param listener the listener
|
||||
*/
|
||||
void addListener(IReaderWriterListener listener);
|
||||
|
||||
/**
|
||||
* Removes a listener.
|
||||
*
|
||||
* @param listener the listener
|
||||
*/
|
||||
void removeListener(IReaderWriterListener listener);
|
||||
|
||||
/**
|
||||
* @param tag the tag to write to
|
||||
*/
|
||||
void writeToNbt(CompoundNBT tag);
|
||||
|
||||
/**
|
||||
* @param tag the tag to read from
|
||||
*/
|
||||
void readFromNbt(CompoundNBT tag);
|
||||
}
|
@@ -1,34 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.api.network.readerwriter;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
|
||||
import net.minecraft.util.Direction;
|
||||
|
||||
/**
|
||||
* Represents a writer network node.
|
||||
*/
|
||||
public interface IWriter extends INetworkNode {
|
||||
/**
|
||||
* @return the redstone strength that this writer is emitting
|
||||
*/
|
||||
int getRedstoneStrength();
|
||||
|
||||
/**
|
||||
* @param strength the redstone strength to be emitted
|
||||
*/
|
||||
void setRedstoneStrength(int strength);
|
||||
|
||||
/**
|
||||
* @return the direction of the writer
|
||||
*/
|
||||
Direction getDirection();
|
||||
|
||||
/**
|
||||
* @return the channel
|
||||
*/
|
||||
String getChannel();
|
||||
|
||||
/**
|
||||
* @param channel the channel
|
||||
*/
|
||||
void setChannel(String channel);
|
||||
}
|
@@ -8,15 +8,12 @@ import com.raoulvdberge.refinedstorage.api.autocrafting.preview.ICraftingPreview
|
||||
import com.raoulvdberge.refinedstorage.api.autocrafting.registry.ICraftingTaskRegistry;
|
||||
import com.raoulvdberge.refinedstorage.api.autocrafting.task.CraftingTaskReadException;
|
||||
import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingRequestInfo;
|
||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||
import com.raoulvdberge.refinedstorage.api.network.grid.ICraftingGridBehavior;
|
||||
import com.raoulvdberge.refinedstorage.api.network.grid.IGridManager;
|
||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
|
||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeManager;
|
||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeProxy;
|
||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeRegistry;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterChannel;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterHandlerRegistry;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.StorageType;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDisk;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDiskManager;
|
||||
@@ -36,8 +33,6 @@ import com.raoulvdberge.refinedstorage.apiimpl.network.NetworkNodeManager;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.NetworkNodeRegistry;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.CraftingGridBehavior;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.GridManager;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.readerwriter.ReaderWriterChannel;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.readerwriter.ReaderWriterHandlerRegistry;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.disk.*;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.util.Comparer;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.util.FluidStackList;
|
||||
@@ -68,7 +63,6 @@ public class API implements IRSAPI {
|
||||
private final ICraftingTaskRegistry craftingTaskRegistry = new CraftingTaskRegistry();
|
||||
private final ICraftingMonitorElementRegistry craftingMonitorElementRegistry = new CraftingMonitorElementRegistry();
|
||||
private final ICraftingPreviewElementRegistry craftingPreviewElementRegistry = new CraftingPreviewElementRegistry();
|
||||
private final IReaderWriterHandlerRegistry readerWriterHandlerRegistry = new ReaderWriterHandlerRegistry();
|
||||
private final IGridManager gridManager = new GridManager();
|
||||
private final ICraftingGridBehavior craftingGridBehavior = new CraftingGridBehavior();
|
||||
private final IStorageDiskRegistry storageDiskRegistry = new StorageDiskRegistry();
|
||||
@@ -142,18 +136,6 @@ public class API implements IRSAPI {
|
||||
return craftingPreviewElementRegistry;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IReaderWriterHandlerRegistry getReaderWriterHandlerRegistry() {
|
||||
return readerWriterHandlerRegistry;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IReaderWriterChannel createReaderWriterChannel(String name, INetwork network) {
|
||||
return new ReaderWriterChannel(name, network);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IStackList<ItemStack> createItemStackList() {
|
||||
|
@@ -1,36 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||
|
||||
public interface IGuiReaderWriter {
|
||||
String getTitle();
|
||||
|
||||
String getChannel();
|
||||
|
||||
void setChannel(String channel);
|
||||
|
||||
TileDataParameter<String, ?> getChannelParameter();
|
||||
|
||||
TileDataParameter<Integer, ?> getRedstoneModeParameter();
|
||||
|
||||
INetwork getNetwork();
|
||||
|
||||
boolean isActive();
|
||||
|
||||
default void onAdd(String name) {
|
||||
INetwork network = getNetwork();
|
||||
|
||||
if (network != null && !name.isEmpty()) {
|
||||
network.getReaderWriterManager().addChannel(name);
|
||||
}
|
||||
}
|
||||
|
||||
default void onRemove(String name) {
|
||||
INetwork network = getNetwork();
|
||||
|
||||
if (network != null && !name.isEmpty()) {
|
||||
network.getReaderWriterManager().removeChannel(name);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,86 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReader;
|
||||
import com.raoulvdberge.refinedstorage.block.NodeBlock;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileReader;
|
||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class NetworkNodeReader extends NetworkNode implements IReader, IGuiReaderWriter {
|
||||
public static final ResourceLocation ID = new ResourceLocation(RS.ID, "reader");
|
||||
|
||||
private static final String NBT_CHANNEL = "Channel";
|
||||
|
||||
private String channel = "";
|
||||
|
||||
public NetworkNodeReader(World world, BlockPos pos) {
|
||||
super(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyUsage() {
|
||||
return RS.INSTANCE.config.readerUsage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRedstoneStrength() {
|
||||
return world.getRedstonePower(pos.offset(getDirection()), getDirection());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return "gui.refinedstorage:reader";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getChannel() {
|
||||
return channel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChannel(String channel) {
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileDataParameter<String, ?> getChannelParameter() {
|
||||
return TileReader.CHANNEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileDataParameter<Integer, ?> getRedstoneModeParameter() {
|
||||
return TileReader.REDSTONE_MODE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return world.getBlockState(pos).get(NodeBlock.CONNECTED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(CompoundNBT tag) {
|
||||
super.read(tag);
|
||||
|
||||
if (tag.contains(NBT_CHANNEL)) {
|
||||
channel = tag.getString(NBT_CHANNEL);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getId() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundNBT write(CompoundNBT tag) {
|
||||
super.write(tag);
|
||||
|
||||
tag.putString(NBT_CHANNEL, channel);
|
||||
|
||||
return tag;
|
||||
}
|
||||
}
|
@@ -1,118 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.RSBlocks;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterChannel;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterHandler;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IWriter;
|
||||
import com.raoulvdberge.refinedstorage.block.NodeBlock;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileWriter;
|
||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class NetworkNodeWriter extends NetworkNode implements IWriter, IGuiReaderWriter {
|
||||
public static final ResourceLocation ID = new ResourceLocation(RS.ID, "writer");
|
||||
|
||||
private static final String NBT_CHANNEL = "Channel";
|
||||
|
||||
private String channel = "";
|
||||
|
||||
private int redstoneStrength;
|
||||
private int lastRedstoneStrength;
|
||||
|
||||
public NetworkNodeWriter(World world, BlockPos pos) {
|
||||
super(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyUsage() {
|
||||
return RS.INSTANCE.config.writerUsage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
|
||||
if (getRedstoneStrength() != lastRedstoneStrength) {
|
||||
lastRedstoneStrength = getRedstoneStrength();
|
||||
|
||||
world.notifyNeighborsOfStateChange(pos, RSBlocks.WRITER);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRedstoneStrength() {
|
||||
return network != null ? redstoneStrength : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRedstoneStrength(int strength) {
|
||||
redstoneStrength = strength;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return "gui.refinedstorage:writer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getChannel() {
|
||||
return channel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChannel(String channel) {
|
||||
if (network != null && channel.equals("")) {
|
||||
IReaderWriterChannel networkChannel = network.getReaderWriterManager().getChannel(this.channel);
|
||||
|
||||
if (networkChannel != null) {
|
||||
for (IReaderWriterHandler handler : networkChannel.getHandlers()) {
|
||||
handler.onWriterDisabled(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileDataParameter<String, ?> getChannelParameter() {
|
||||
return TileWriter.CHANNEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileDataParameter<Integer, ?> getRedstoneModeParameter() {
|
||||
return TileWriter.REDSTONE_MODE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return world.getBlockState(pos).get(NodeBlock.CONNECTED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(CompoundNBT tag) {
|
||||
super.read(tag);
|
||||
|
||||
if (tag.contains(NBT_CHANNEL)) {
|
||||
channel = tag.getString(NBT_CHANNEL);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getId() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundNBT write(CompoundNBT tag) {
|
||||
super.write(tag);
|
||||
|
||||
tag.putString(NBT_CHANNEL, channel);
|
||||
|
||||
return tag;
|
||||
}
|
||||
}
|
@@ -1,70 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.apiimpl.network.readerwriter;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.*;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ReaderWriterChannel implements IReaderWriterChannel {
|
||||
private static final String NBT_HANDLER = "Handler_%s";
|
||||
|
||||
private String name;
|
||||
private INetwork network;
|
||||
|
||||
private List<IReaderWriterHandler> handlers = new ArrayList<>();
|
||||
|
||||
public ReaderWriterChannel(String name, INetwork network) {
|
||||
this.name = name;
|
||||
this.network = network;
|
||||
this.handlers.addAll(API.instance().getReaderWriterHandlerRegistry().all().stream().map(f -> f.create(null)).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IReaderWriterHandler> getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IReader> getReaders() {
|
||||
return network.getNodeGraph().all().stream()
|
||||
.filter(n -> n instanceof IReader && name.equals(((IReader) n).getChannel()))
|
||||
.map(n -> (IReader) n)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IWriter> getWriters() {
|
||||
return network.getNodeGraph().all().stream()
|
||||
.filter(n -> n instanceof IWriter && name.equals(((IWriter) n).getChannel()))
|
||||
.map(n -> (IWriter) n)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundNBT writeToNbt(CompoundNBT tag) {
|
||||
for (IReaderWriterHandler handler : handlers) {
|
||||
tag.put(String.format(NBT_HANDLER, handler.getId()), handler.writeToNbt(new CompoundNBT()));
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNbt(CompoundNBT tag) {
|
||||
for (IReaderWriterHandler handler : handlers) {
|
||||
String id = String.format(NBT_HANDLER, handler.getId());
|
||||
|
||||
if (tag.contains(id)) {
|
||||
IReaderWriterHandlerFactory factory = API.instance().getReaderWriterHandlerRegistry().get(id);
|
||||
|
||||
if (factory != null) {
|
||||
handlers.add(factory.create(tag.getCompound(id)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,227 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.apiimpl.network.readerwriter;
|
||||
/* TODO
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReader;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterChannel;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterHandler;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IWriter;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidTankProperties;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class ReaderWriterHandlerFluids implements IReaderWriterHandler {
|
||||
public static final String ID = "fluids";
|
||||
|
||||
private static final IFluidHandler NULL_CAP = new IFluidHandler() {
|
||||
@Override
|
||||
public IFluidTankProperties[] getTankProperties() {
|
||||
return new IFluidTankProperties[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(FluidStack resource, boolean doFill) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public FluidStack drain(FluidStack resource, boolean doDrain) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public FluidStack drain(int maxDrain, boolean doDrain) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
private FluidTank tank;
|
||||
private FluidTankReaderWriter tankReader, tankWriter;
|
||||
|
||||
public ReaderWriterHandlerFluids(@Nullable CompoundNBT tag) {
|
||||
this.tank = new FluidTank(16 * Fluid.BUCKET_VOLUME);
|
||||
this.tankReader = new FluidTankReaderWriter(tank, true, false);
|
||||
this.tankWriter = new FluidTankReaderWriter(tank, false, true);
|
||||
|
||||
if (tag != null) {
|
||||
this.tank.readFromNBT(tag);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(IReaderWriterChannel channel) {
|
||||
// NO OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWriterDisabled(IWriter writer) {
|
||||
// NO OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapabilityReader(IReader reader, Capability<?> capability) {
|
||||
return capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapabilityReader(IReader reader, Capability<T> capability) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(tankReader);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapabilityWriter(IWriter writer, Capability<?> capability) {
|
||||
return capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapabilityWriter(IWriter writer, Capability<T> capability) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(tankWriter);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getNullCapability() {
|
||||
return NULL_CAP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundNBT writeToNbt(CompoundNBT tag) {
|
||||
tank.writeToNBT(tag);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ITextComponent> getStatusReader(IReader reader, IReaderWriterChannel channel) {
|
||||
return getStatus(tankReader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ITextComponent> getStatusWriter(IWriter writer, IReaderWriterChannel channel) {
|
||||
return getStatus(tankWriter);
|
||||
}
|
||||
|
||||
private List<ITextComponent> getStatus(IFluidTank tank) {
|
||||
FluidStack stack = tank.getFluid();
|
||||
|
||||
if (stack == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return Collections.singletonList(new TextComponentString(API.instance().getQuantityFormatter().format(stack.amount) + " mB ").appendSibling(new TextComponentTranslation(stack.getUnlocalizedName())));
|
||||
}
|
||||
|
||||
private class FluidTankReaderWriter implements IFluidTank, IFluidHandler {
|
||||
private FluidTank parent;
|
||||
private boolean canFill, canDrain;
|
||||
private IFluidTankProperties[] properties;
|
||||
|
||||
public FluidTankReaderWriter(FluidTank parent, boolean canFill, boolean canDrain) {
|
||||
this.parent = parent;
|
||||
|
||||
this.canFill = canFill;
|
||||
this.canDrain = canDrain;
|
||||
|
||||
this.properties = new IFluidTankProperties[]{
|
||||
new IFluidTankProperties() {
|
||||
@Nullable
|
||||
@Override
|
||||
public FluidStack getContents() {
|
||||
return parent.getFluid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
return parent.getCapacity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill() {
|
||||
return canFill;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain() {
|
||||
return canDrain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFillFluidType(FluidStack fluidStack) {
|
||||
return canFill;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrainFluidType(FluidStack fluidStack) {
|
||||
return canDrain;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public FluidStack getFluid() {
|
||||
return parent.getFluid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFluidAmount() {
|
||||
return parent.getFluidAmount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
return parent.getCapacity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo getInfo() {
|
||||
return parent.getInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFluidTankProperties[] getTankProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(FluidStack resource, boolean doFill) {
|
||||
return canFill ? parent.fill(resource, doFill) : 0;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public FluidStack drain(FluidStack resource, boolean doDrain) {
|
||||
return canDrain ? parent.drain(resource, doDrain) : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public FluidStack drain(int maxDrain, boolean doDrain) {
|
||||
return canDrain ? parent.drain(maxDrain, doDrain) : null;
|
||||
}
|
||||
}
|
||||
}*/
|
@@ -1,192 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.apiimpl.network.readerwriter;
|
||||
/* TODO
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReader;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterChannel;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterHandler;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IWriter;
|
||||
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ReaderWriterHandlerItems implements IReaderWriterHandler {
|
||||
public static final String ID = "items";
|
||||
|
||||
private static final IItemHandler NULL_CAP = new IItemHandler() {
|
||||
@Override
|
||||
public int getSlots() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack extractItem(int slot, int amount, boolean simulate) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlotLimit(int slot) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(int slot, @Nonnull ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
private ItemStackHandler items;
|
||||
private ItemHandlerReaderWriter itemsReader, itemsWriter;
|
||||
|
||||
public ReaderWriterHandlerItems(@Nullable CompoundNBT tag) {
|
||||
this.items = new ItemStackHandler(16);
|
||||
this.itemsWriter = new ItemHandlerReaderWriter(items, false, true);
|
||||
this.itemsReader = new ItemHandlerReaderWriter(items, true, false);
|
||||
|
||||
if (tag != null) {
|
||||
StackUtils.readItems(items, 0, tag);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(IReaderWriterChannel channel) {
|
||||
// NO OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWriterDisabled(IWriter writer) {
|
||||
// NO OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapabilityReader(IReader reader, Capability<?> capability) {
|
||||
return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapabilityReader(IReader reader, Capability<T> capability) {
|
||||
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
||||
return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(itemsReader);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapabilityWriter(IWriter writer, Capability<?> capability) {
|
||||
return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapabilityWriter(IWriter writer, Capability<T> capability) {
|
||||
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
||||
return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.(itemsWriter);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getNullCapability() {
|
||||
return NULL_CAP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundNBT writeToNbt(CompoundNBT tag) {
|
||||
StackUtils.writeItems(items, 0, tag);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ITextComponent> getStatusReader(IReader reader, IReaderWriterChannel channel) {
|
||||
return getStatus(itemsReader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ITextComponent> getStatusWriter(IWriter writer, IReaderWriterChannel channel) {
|
||||
return getStatus(itemsWriter);
|
||||
}
|
||||
|
||||
private List<ITextComponent> getStatus(IItemHandler handler) {
|
||||
List<ITextComponent> components = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < handler.getSlots(); ++i) {
|
||||
ItemStack stack = handler.getStackInSlot(i);
|
||||
|
||||
if (!stack.isEmpty()) {
|
||||
components.add(new TextComponentString(stack.getCount() + "x ").appendSibling(new TextComponentTranslation(stack.getTranslationKey() + ".name")));
|
||||
}
|
||||
}
|
||||
|
||||
return components;
|
||||
}
|
||||
|
||||
private class ItemHandlerReaderWriter implements IItemHandler {
|
||||
private IItemHandler parent;
|
||||
private boolean canInsert, canExtract;
|
||||
|
||||
public ItemHandlerReaderWriter(IItemHandler parent, boolean canInsert, boolean canExtract) {
|
||||
this.parent = parent;
|
||||
this.canInsert = canInsert;
|
||||
this.canExtract = canExtract;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlots() {
|
||||
return parent.getSlots();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return parent.getStackInSlot(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) {
|
||||
return canInsert ? parent.insertItem(slot, stack, simulate) : stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ItemStack extractItem(int slot, int amount, boolean simulate) {
|
||||
return canExtract ? parent.extractItem(slot, amount, simulate) : ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlotLimit(int slot) {
|
||||
return parent.getSlotLimit(slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
@@ -1,96 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.apiimpl.network.readerwriter;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReader;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterChannel;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterHandler;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IWriter;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class ReaderWriterHandlerRedstone implements IReaderWriterHandler {
|
||||
public static final String ID = "redstone";
|
||||
|
||||
@Override
|
||||
public void update(IReaderWriterChannel channel) {
|
||||
int strength = getStrength(channel);
|
||||
|
||||
for (IWriter writer : channel.getWriters()) {
|
||||
writer.setRedstoneStrength(strength);
|
||||
}
|
||||
}
|
||||
|
||||
private int getStrength(IReaderWriterChannel channel) {
|
||||
int strength = 0;
|
||||
|
||||
for (IReader reader : channel.getReaders()) {
|
||||
strength += reader.getRedstoneStrength();
|
||||
}
|
||||
|
||||
return strength;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWriterDisabled(IWriter writer) {
|
||||
writer.setRedstoneStrength(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapabilityReader(IReader reader, Capability<?> capability) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapabilityReader(IReader reader, Capability<T> capability) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapabilityWriter(IWriter writer, Capability<?> capability) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapabilityWriter(IWriter writer, Capability<T> capability) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getNullCapability() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundNBT writeToNbt(CompoundNBT tag) {
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ITextComponent> getStatusReader(IReader reader, IReaderWriterChannel channel) {
|
||||
return getStatus(channel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ITextComponent> getStatusWriter(IWriter writer, IReaderWriterChannel channel) {
|
||||
return getStatus(channel);
|
||||
}
|
||||
|
||||
private List<ITextComponent> getStatus(IReaderWriterChannel channel) {
|
||||
int strength = getStrength(channel);
|
||||
|
||||
if (strength == 0) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return Collections.singletonList(new TranslationTextComponent("misc.refinedstorage:reader_writer.redstone", strength));
|
||||
}
|
||||
}
|
@@ -1,29 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.apiimpl.network.readerwriter;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterHandlerFactory;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterHandlerRegistry;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ReaderWriterHandlerRegistry implements IReaderWriterHandlerRegistry {
|
||||
private Map<String, IReaderWriterHandlerFactory> factories = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void add(String id, IReaderWriterHandlerFactory factory) {
|
||||
factories.put(id, factory);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IReaderWriterHandlerFactory get(String id) {
|
||||
return factories.get(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<IReaderWriterHandlerFactory> all() {
|
||||
return factories.values();
|
||||
}
|
||||
}
|
@@ -1,114 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.apiimpl.network.readerwriter;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterChannel;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterHandler;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterListener;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterManager;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
|
||||
public class ReaderWriterManager implements IReaderWriterManager {
|
||||
private static final String NBT_CHANNELS = "ReaderWriterChannels";
|
||||
private static final String NBT_NAME = "Name";
|
||||
|
||||
private INetwork network;
|
||||
private Map<String, IReaderWriterChannel> channels = new HashMap<>();
|
||||
private Set<IReaderWriterListener> listeners = new HashSet<>();
|
||||
|
||||
public ReaderWriterManager(INetwork network) {
|
||||
this.network = network;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
for (IReaderWriterChannel channel : channels.values()) {
|
||||
for (IReaderWriterHandler handler : channel.getHandlers()) {
|
||||
handler.update(channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IReaderWriterChannel getChannel(String name) {
|
||||
return channels.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addChannel(String name) {
|
||||
channels.put(name, API.instance().createReaderWriterChannel(name, network));
|
||||
|
||||
listeners.forEach(IReaderWriterListener::onChanged);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeChannel(String name) {
|
||||
IReaderWriterChannel channel = getChannel(name);
|
||||
|
||||
if (channel != null) {
|
||||
channel.getReaders().forEach(reader -> reader.setChannel(""));
|
||||
channel.getWriters().forEach(writer -> writer.setChannel(""));
|
||||
|
||||
channels.remove(name);
|
||||
|
||||
listeners.forEach(IReaderWriterListener::onChanged);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getChannels() {
|
||||
return channels.keySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(IReaderWriterListener listener) {
|
||||
listeners.add(listener);
|
||||
|
||||
listener.onAttached();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener(IReaderWriterListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNbt(CompoundNBT tag) {
|
||||
ListNBT readerWriterChannelsList = new ListNBT();
|
||||
|
||||
for (Map.Entry<String, IReaderWriterChannel> entry : channels.entrySet()) {
|
||||
CompoundNBT channelTag = entry.getValue().writeToNbt(new CompoundNBT());
|
||||
|
||||
channelTag.putString(NBT_NAME, entry.getKey());
|
||||
|
||||
readerWriterChannelsList.add(channelTag);
|
||||
}
|
||||
|
||||
tag.put(NBT_CHANNELS, readerWriterChannelsList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNbt(CompoundNBT tag) {
|
||||
if (tag.contains(NBT_CHANNELS)) {
|
||||
ListNBT readerWriterChannelsList = tag.getList(NBT_CHANNELS, Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
for (int i = 0; i < readerWriterChannelsList.size(); ++i) {
|
||||
CompoundNBT channelTag = readerWriterChannelsList.getCompound(i);
|
||||
|
||||
String name = channelTag.getString(NBT_NAME);
|
||||
|
||||
IReaderWriterChannel channel = API.instance().createReaderWriterChannel(name, network);
|
||||
|
||||
channel.readFromNbt(channelTag);
|
||||
|
||||
channels.put(name, channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,64 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.block;
|
||||
|
||||
public class BlockReader extends CableBlock {
|
||||
/* TODO
|
||||
public BlockReader() {
|
||||
super(createBuilder("reader").tileEntity(TileReader::new).create());
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void registerModels(IModelRegistration modelRegistration) {
|
||||
modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "connected=false,direction=north,down=false,east=true,north=false,south=false,up=false,west=true"));
|
||||
|
||||
registerCoverAndFullbright(modelRegistration, RS.ID + ":blocks/reader/cutouts/connected");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public BlockDirection getDirection() {
|
||||
return BlockDirection.ANY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CollisionGroup> getCollisions(TileEntity tile, BlockState state) {
|
||||
return RSBlocks.CONSTRUCTOR.getCollisions(tile, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) {
|
||||
if (!canAccessGui(state, world, pos, hitX, hitY, hitZ)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!world.isRemote) {
|
||||
NetworkNodeReader reader = ((TileReader) world.getTileEntity(pos)).getNode();
|
||||
|
||||
if (player.isSneaking()) {
|
||||
if (reader.getNetwork() != null) {
|
||||
IReaderWriterChannel channel = reader.getNetwork().getReaderWriterManager().getChannel(reader.getChannel());
|
||||
|
||||
if (channel != null) {
|
||||
channel.getHandlers().stream().map(h -> h.getStatusReader(reader, channel)).flatMap(List::stream).forEach(player::sendMessage);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
openNetworkGui(RSGui.READER_WRITER, player, world, pos, side);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectRedstone(BlockState state, IBlockAccess world, BlockPos pos, Direction side) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
return tile instanceof TileReader && side == ((TileReader) tile).getDirection().getOpposite();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasConnectedState() {
|
||||
return true;
|
||||
}*/
|
||||
}
|
@@ -1,84 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.block;
|
||||
|
||||
public class BlockWriter extends CableBlock {
|
||||
/* TODO
|
||||
public BlockWriter() {
|
||||
super(createBuilder("writer").tileEntity(TileWriter::new).create());
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void registerModels(IModelRegistration modelRegistration) {
|
||||
modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "connected=false,direction=north,down=false,east=true,north=false,south=false,up=false,west=true"));
|
||||
|
||||
registerCoverAndFullbright(modelRegistration, RS.ID + ":blocks/writer/cutouts/connected");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public BlockDirection getDirection() {
|
||||
return BlockDirection.ANY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CollisionGroup> getCollisions(TileEntity tile, BlockState state) {
|
||||
return RSBlocks.CONSTRUCTOR.getCollisions(tile, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) {
|
||||
if (!canAccessGui(state, world, pos, hitX, hitY, hitZ)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!world.isRemote) {
|
||||
NetworkNodeWriter writer = ((TileWriter) world.getTileEntity(pos)).getNode();
|
||||
|
||||
if (player.isSneaking()) {
|
||||
if (writer.getNetwork() != null) {
|
||||
IReaderWriterChannel channel = writer.getNetwork().getReaderWriterManager().getChannel(writer.getChannel());
|
||||
|
||||
if (channel != null) {
|
||||
channel.getHandlers().stream().map(h -> h.getStatusWriter(writer, channel)).flatMap(List::stream).forEach(player::sendMessage);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
openNetworkGui(RSGui.READER_WRITER, player, world, pos, side);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public int getWeakPower(BlockState state, IBlockAccess world, BlockPos pos, Direction side) {
|
||||
IWriter writer = ((TileWriter) world.getTileEntity(pos)).getNode();
|
||||
|
||||
return side == writer.getDirection().getOpposite() ? writer.getRedstoneStrength() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public int getStrongPower(BlockState state, IBlockAccess world, BlockPos pos, Direction side) {
|
||||
return getWeakPower(state, world, pos, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean canProvidePower(BlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectRedstone(BlockState state, IBlockAccess world, BlockPos pos, Direction side) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
return tile instanceof TileWriter && side == ((TileWriter) tile).getDirection().getOpposite();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasConnectedState() {
|
||||
return true;
|
||||
}*/
|
||||
}
|
@@ -3,9 +3,9 @@ package com.raoulvdberge.refinedstorage.container;
|
||||
import com.raoulvdberge.refinedstorage.RSContainers;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.filter.FilterSlot;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.filter.FluidFilterSlot;
|
||||
import com.raoulvdberge.refinedstorage.inventory.fluid.FilterFluidInventory;
|
||||
import com.raoulvdberge.refinedstorage.inventory.fluid.FilterIconFluidInventory;
|
||||
import com.raoulvdberge.refinedstorage.inventory.fluid.FluidInventory;
|
||||
import com.raoulvdberge.refinedstorage.inventory.fluid.FluidInventoryFilter;
|
||||
import com.raoulvdberge.refinedstorage.inventory.fluid.FluidInventoryFilterIcon;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.FilterIconItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.FilterItemsItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.item.FilterItem;
|
||||
@@ -25,7 +25,7 @@ public class FilterContainer extends BaseContainer {
|
||||
int x = 8;
|
||||
|
||||
FilterItemsItemHandler filter = new FilterItemsItemHandler(stack);
|
||||
FluidInventory fluidFilter = new FluidInventoryFilter(stack);
|
||||
FluidInventory fluidFilter = new FilterFluidInventory(stack);
|
||||
|
||||
for (int i = 0; i < 27; ++i) {
|
||||
addSlot(new FilterSlot(filter, i, x, y).setEnableHandler(() -> FilterItem.getType(stack) == IType.ITEMS));
|
||||
@@ -40,7 +40,7 @@ public class FilterContainer extends BaseContainer {
|
||||
}
|
||||
|
||||
addSlot(new FilterSlot(new FilterIconItemHandler(stack), 0, 8, 117).setEnableHandler(() -> FilterItem.getType(stack) == IType.ITEMS));
|
||||
addSlot(new FluidFilterSlot(new FluidInventoryFilterIcon(stack), 0, 8, 117).setEnableHandler(() -> FilterItem.getType(stack) == IType.FLUIDS));
|
||||
addSlot(new FluidFilterSlot(new FilterIconFluidInventory(stack), 0, 8, 117).setEnableHandler(() -> FilterItem.getType(stack) == IType.FLUIDS));
|
||||
|
||||
addPlayerInventory(8, 149);
|
||||
|
||||
|
@@ -1,61 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.container;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RSContainers;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterListener;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterManager;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.IGuiReaderWriter;
|
||||
import com.raoulvdberge.refinedstorage.tile.BaseTile;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
||||
public class ReaderWriterContainer extends BaseContainer implements IReaderWriterListener {
|
||||
private IGuiReaderWriter readerWriter;
|
||||
private boolean addedListener;
|
||||
|
||||
public ReaderWriterContainer(IGuiReaderWriter readerWriter, BaseTile tile, PlayerEntity player, int windowId) {
|
||||
super(RSContainers.READER_WRITER, tile, player, windowId);
|
||||
|
||||
this.readerWriter = readerWriter;
|
||||
|
||||
addPlayerInventory(8, 127);
|
||||
}
|
||||
|
||||
public IGuiReaderWriter getReaderWriter() {
|
||||
return readerWriter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
|
||||
IReaderWriterManager manager = readerWriter.getNetwork() == null ? null : readerWriter.getNetwork().getReaderWriterManager();
|
||||
if (!getPlayer().world.isRemote) {
|
||||
if (manager != null && !addedListener) {
|
||||
manager.addListener(this);
|
||||
|
||||
this.addedListener = true;
|
||||
} else if (manager == null && addedListener) {
|
||||
this.addedListener = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(PlayerEntity player) {
|
||||
super.onContainerClosed(player);
|
||||
|
||||
IReaderWriterManager manager = readerWriter.getNetwork() == null ? null : readerWriter.getNetwork().getReaderWriterManager();
|
||||
if (!player.getEntityWorld().isRemote && manager != null && addedListener) {
|
||||
manager.removeListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttached() {
|
||||
onChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChanged() {
|
||||
// TODO RS.INSTANCE.network.sendTo(new MessageReaderWriterUpdate(readerWriter.getNetwork().getReaderWriterManager().getChannels()), (ServerPlayerEntity) getPlayer());
|
||||
}
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
package com.raoulvdberge.refinedstorage.integration.forgeenergy;
|
||||
package com.raoulvdberge.refinedstorage.energy;
|
||||
|
||||
import net.minecraftforge.energy.EnergyStorage;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package com.raoulvdberge.refinedstorage.integration.forgeenergy;
|
||||
package com.raoulvdberge.refinedstorage.energy;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
@@ -1,184 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.integration.forgeenergy;
|
||||
|
||||
/* TODO
|
||||
public class ReaderWriterHandlerForgeEnergy implements IReaderWriterHandler {
|
||||
public static final String ID = "forgeenergy";
|
||||
|
||||
private static final IEnergyStorage NULL_CAP = new IEnergyStorage() {
|
||||
@Override
|
||||
public int receiveEnergy(int maxReceive, boolean simulate) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(int maxExtract, boolean simulate) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtract() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReceive() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
private static final String NBT_ENERGY_STORED = "EnergyStored";
|
||||
|
||||
private EnergyStorage storage;
|
||||
private EnergyStorageReaderWriter storageReader, storageWriter;
|
||||
|
||||
public ReaderWriterHandlerForgeEnergy(@Nullable CompoundNBT tag) {
|
||||
this.storage = new EnergyStorage(RS.INSTANCE.config.readerWriterChannelEnergyCapacity);
|
||||
this.storageReader = new EnergyStorageReaderWriter(storage, false, true);
|
||||
this.storageWriter = new EnergyStorageReaderWriter(storage, true, false);
|
||||
|
||||
if (tag != null && tag.hasKey(NBT_ENERGY_STORED)) {
|
||||
storage.receiveEnergy(tag.getInteger(NBT_ENERGY_STORED), false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(IReaderWriterChannel channel) {
|
||||
if (channel.getWriters().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int toSend = (int) Math.floor((float) storage.getEnergyStored() / (float) channel.getWriters().size());
|
||||
int toExtract = 0;
|
||||
|
||||
for (IWriter writer : channel.getWriters()) {
|
||||
if (writer.canUpdate()) {
|
||||
TileEntity tile = writer.getWorld().getTileEntity(writer.getPos().offset(writer.getDirection()));
|
||||
|
||||
if (tile != null && tile.hasCapability(CapabilityEnergy.ENERGY, writer.getDirection().getOpposite())) {
|
||||
toExtract += tile.getCapability(CapabilityEnergy.ENERGY, writer.getDirection().getOpposite()).receiveEnergy(storage.extractEnergy(toSend, true), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
storage.extractEnergy(toExtract, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWriterDisabled(IWriter writer) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapabilityReader(IReader reader, Capability<?> capability) {
|
||||
return capability == CapabilityEnergy.ENERGY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapabilityReader(IReader reader, Capability<T> capability) {
|
||||
if (capability == CapabilityEnergy.ENERGY) {
|
||||
return CapabilityEnergy.ENERGY.cast(storageReader);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapabilityWriter(IWriter writer, Capability<?> capability) {
|
||||
return capability == CapabilityEnergy.ENERGY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapabilityWriter(IWriter writer, Capability<T> capability) {
|
||||
if (capability == CapabilityEnergy.ENERGY) {
|
||||
return CapabilityEnergy.ENERGY.cast(storageWriter);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getNullCapability() {
|
||||
return NULL_CAP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundNBT writeToNbt(CompoundNBT tag) {
|
||||
tag.putInt(NBT_ENERGY_STORED, storage.getEnergyStored());
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ITextComponent> getStatusReader(IReader reader, IReaderWriterChannel channel) {
|
||||
return getStatus(storageReader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ITextComponent> getStatusWriter(IWriter writer, IReaderWriterChannel channel) {
|
||||
return getStatus(storageWriter);
|
||||
}
|
||||
|
||||
private List<ITextComponent> getStatus(IEnergyStorage storage) {
|
||||
if (storage.getEnergyStored() == 0) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return Collections.singletonList(new TextComponentTranslation("misc.refinedstorage.energy_stored", storage.getEnergyStored(), storage.getMaxEnergyStored()));
|
||||
}
|
||||
|
||||
private class EnergyStorageReaderWriter implements IEnergyStorage {
|
||||
private IEnergyStorage parent;
|
||||
private boolean canExtract, canReceive;
|
||||
|
||||
EnergyStorageReaderWriter(IEnergyStorage parent, boolean canExtract, boolean canReceive) {
|
||||
this.canExtract = canExtract;
|
||||
this.canReceive = canReceive;
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(int maxReceive, boolean simulate) {
|
||||
return canReceive ? parent.receiveEnergy(maxReceive, simulate) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(int maxExtract, boolean simulate) {
|
||||
return canExtract ? parent.extractEnergy(maxExtract, simulate) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored() {
|
||||
return parent.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored() {
|
||||
return parent.getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtract() {
|
||||
return canExtract;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReceive() {
|
||||
return canReceive;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
@@ -6,8 +6,8 @@ import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class FluidInventoryFilter extends FluidInventory {
|
||||
public FluidInventoryFilter(ItemStack stack) {
|
||||
public class FilterFluidInventory extends FluidInventory {
|
||||
public FilterFluidInventory(ItemStack stack) {
|
||||
super(27, Integer.MAX_VALUE);
|
||||
|
||||
this.addListener((handler, slot, reading) -> {
|
@@ -5,8 +5,8 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class FluidInventoryFilterIcon extends FluidInventory {
|
||||
public FluidInventoryFilterIcon(ItemStack stack) {
|
||||
public class FilterIconFluidInventory extends FluidInventory {
|
||||
public FilterIconFluidInventory(ItemStack stack) {
|
||||
super(1, Integer.MAX_VALUE);
|
||||
|
||||
this.addListener((handler, slot, reading) -> {
|
@@ -6,7 +6,7 @@ import com.raoulvdberge.refinedstorage.api.util.IFilter;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.GridTab;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.util.FluidFilter;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.util.ItemFilter;
|
||||
import com.raoulvdberge.refinedstorage.inventory.fluid.FluidInventoryFilter;
|
||||
import com.raoulvdberge.refinedstorage.inventory.fluid.FilterFluidInventory;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.validator.ItemValidator;
|
||||
import com.raoulvdberge.refinedstorage.item.FilterItem;
|
||||
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
|
||||
@@ -69,7 +69,7 @@ public class FilterItemHandler extends BaseItemHandler {
|
||||
}
|
||||
}
|
||||
|
||||
FluidInventoryFilter fluids = new FluidInventoryFilter(filter);
|
||||
FilterFluidInventory fluids = new FilterFluidInventory(filter);
|
||||
|
||||
for (FluidStack stack : fluids.getFilteredFluids()) {
|
||||
filters.add(new FluidFilter(stack, compare, mode, modFilter));
|
||||
|
@@ -5,7 +5,7 @@ import com.raoulvdberge.refinedstorage.RSItems;
|
||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||
import com.raoulvdberge.refinedstorage.api.util.IFilter;
|
||||
import com.raoulvdberge.refinedstorage.container.FilterContainer;
|
||||
import com.raoulvdberge.refinedstorage.inventory.fluid.FluidInventoryFilter;
|
||||
import com.raoulvdberge.refinedstorage.inventory.fluid.FilterFluidInventory;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.FilterItemsItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
||||
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||
@@ -89,7 +89,7 @@ public class FilterItem extends Item {
|
||||
|
||||
RenderUtils.addCombinedItemsToTooltip(tooltip, false, items.getFilteredItems());
|
||||
|
||||
FluidInventoryFilter fluids = new FluidInventoryFilter(stack);
|
||||
FilterFluidInventory fluids = new FilterFluidInventory(stack);
|
||||
|
||||
RenderUtils.addCombinedFluidsToTooltip(tooltip, false, fluids.getFilteredFluids());
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.raoulvdberge.refinedstorage.item.capabilityprovider;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.integration.forgeenergy.ItemEnergyStorage;
|
||||
import com.raoulvdberge.refinedstorage.energy.ItemEnergyStorage;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
|
@@ -1,35 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.network;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.container.ReaderWriterContainer;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraftforge.fml.common.network.ByteBufUtils;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
|
||||
public class MessageReaderWriterChannelAdd extends MessageHandlerPlayerToServer<MessageReaderWriterChannelAdd> implements IMessage {
|
||||
private String name;
|
||||
|
||||
public MessageReaderWriterChannelAdd() {
|
||||
}
|
||||
|
||||
public MessageReaderWriterChannelAdd(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
name = ByteBufUtils.readUTF8String(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
ByteBufUtils.writeUTF8String(buf, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(MessageReaderWriterChannelAdd message, ServerPlayerEntity player) {
|
||||
if (player.openContainer instanceof ContainerReaderWriter) {
|
||||
((ContainerReaderWriter) player.openContainer).getReaderWriter().onAdd(message.name);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,35 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.network;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.container.ReaderWriterContainer;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraftforge.fml.common.network.ByteBufUtils;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
|
||||
public class MessageReaderWriterChannelRemove extends MessageHandlerPlayerToServer<MessageReaderWriterChannelRemove> implements IMessage {
|
||||
private String name;
|
||||
|
||||
public MessageReaderWriterChannelRemove() {
|
||||
}
|
||||
|
||||
public MessageReaderWriterChannelRemove(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
name = ByteBufUtils.readUTF8String(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
ByteBufUtils.writeUTF8String(buf, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(MessageReaderWriterChannelRemove message, ServerPlayerEntity player) {
|
||||
if (player.openContainer instanceof ContainerReaderWriter) {
|
||||
((ContainerReaderWriter) player.openContainer).getReaderWriter().onRemove(message.name);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,49 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.network;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.gui.GuiBase;
|
||||
import com.raoulvdberge.refinedstorage.gui.GuiReaderWriter;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraftforge.fml.common.network.ByteBufUtils;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class MessageReaderWriterUpdate implements IMessage, IMessageHandler<MessageReaderWriterUpdate, IMessage> {
|
||||
private List<String> channels = new ArrayList<>();
|
||||
|
||||
public MessageReaderWriterUpdate() {
|
||||
}
|
||||
|
||||
public MessageReaderWriterUpdate(Collection<String> channels) {
|
||||
this.channels = new ArrayList<>(channels);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
int size = buf.readInt();
|
||||
|
||||
for (int i = 0; i < size; ++i) {
|
||||
channels.add(ByteBufUtils.readUTF8String(buf));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
buf.writeInt(channels.size());
|
||||
|
||||
for (String channel : channels) {
|
||||
ByteBufUtils.writeUTF8String(buf, channel);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(MessageReaderWriterUpdate message, MessageContext ctx) {
|
||||
GuiBase.executeLater(GuiReaderWriter.class, readerWriter -> readerWriter.setChannels(message.channels));
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -27,11 +27,6 @@ public class ProxyCommon {
|
||||
API.instance().getCraftingPreviewElementRegistry().add(CraftingPreviewElementFluidStack.ID, CraftingPreviewElementFluidStack::fromByteBuf);
|
||||
API.instance().getCraftingPreviewElementRegistry().add(CraftingPreviewElementError.ID, CraftingPreviewElementError::fromByteBuf);
|
||||
|
||||
API.instance().getReaderWriterHandlerRegistry().add(ReaderWriterHandlerItems.ID, ReaderWriterHandlerItems::new);
|
||||
API.instance().getReaderWriterHandlerRegistry().add(ReaderWriterHandlerFluids.ID, ReaderWriterHandlerFluids::new);
|
||||
API.instance().getReaderWriterHandlerRegistry().add(ReaderWriterHandlerRedstone.ID, tag -> new ReaderWriterHandlerRedstone());
|
||||
API.instance().getReaderWriterHandlerRegistry().add(ReaderWriterHandlerForgeEnergy.ID, ReaderWriterHandlerForgeEnergy::new);
|
||||
|
||||
IntegrationInventorySorter.register();
|
||||
}
|
||||
|
||||
|
@@ -1,37 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.render.collision;
|
||||
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
public class AdvancedRayTraceResult<T extends RayTraceResult> {
|
||||
private CollisionGroup group;
|
||||
private AxisAlignedBB bounds;
|
||||
private T hit;
|
||||
|
||||
public AdvancedRayTraceResult(CollisionGroup group, AxisAlignedBB bounds, T hit) {
|
||||
this.group = group;
|
||||
this.bounds = bounds;
|
||||
this.hit = hit;
|
||||
}
|
||||
|
||||
public boolean valid() {
|
||||
return hit != null && bounds != null;
|
||||
}
|
||||
|
||||
public double squareDistanceTo(Vec3d vec) {
|
||||
return hit.getHitVec().squareDistanceTo(vec);
|
||||
}
|
||||
|
||||
public CollisionGroup getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
public AxisAlignedBB getBounds() {
|
||||
return bounds;
|
||||
}
|
||||
|
||||
public T getHit() {
|
||||
return hit;
|
||||
}
|
||||
}
|
@@ -1,64 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.render.collision;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
|
||||
public final class AdvancedRayTracer {
|
||||
public static Vec3d getStart(PlayerEntity player) {
|
||||
return new Vec3d(player.posX, player.posY + player.getEyeHeight(), player.posZ);
|
||||
}
|
||||
|
||||
public static Vec3d getEnd(PlayerEntity player) {
|
||||
double reachDistance = player instanceof ServerPlayerEntity ? player.getAttribute(PlayerEntity.REACH_DISTANCE).getValue() : (player.isCreative() ? 5.0D : 4.5D);
|
||||
|
||||
Vec3d lookVec = player.getLookVec();
|
||||
Vec3d start = getStart(player);
|
||||
|
||||
return start.add(lookVec.x * reachDistance, lookVec.y * reachDistance, lookVec.z * reachDistance);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static AdvancedRayTraceResult<RayTraceResult> rayTrace(BlockPos pos, Vec3d start, Vec3d end, Collection<CollisionGroup> groups) {
|
||||
double minDistance = Double.POSITIVE_INFINITY;
|
||||
AdvancedRayTraceResult hit = null;
|
||||
int i = -1;
|
||||
|
||||
for (CollisionGroup group : groups) {
|
||||
for (AxisAlignedBB aabb : group.getItems()) {
|
||||
AdvancedRayTraceResult result = rayTrace(pos, start, end, aabb, i, group);
|
||||
|
||||
if (result != null) {
|
||||
double d = result.squareDistanceTo(start);
|
||||
|
||||
if (d < minDistance) {
|
||||
minDistance = d;
|
||||
hit = result;
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
return hit;
|
||||
}
|
||||
|
||||
public static AdvancedRayTraceResult<RayTraceResult> rayTrace(BlockPos pos, Vec3d start, Vec3d end, AxisAlignedBB bounds, int subHit, CollisionGroup group) {
|
||||
RayTraceResult result = AxisAlignedBB.rayTrace(group.getItems(), start, end, pos); // TODO: Correct?
|
||||
|
||||
if (result == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
result.subHit = subHit;
|
||||
|
||||
return new AdvancedRayTraceResult<>(group, bounds, result);
|
||||
}
|
||||
}
|
@@ -1,224 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.screen;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.IGuiReaderWriter;
|
||||
import com.raoulvdberge.refinedstorage.container.ReaderWriterContainer;
|
||||
import com.raoulvdberge.refinedstorage.screen.widget.ScrollbarWidget;
|
||||
import com.raoulvdberge.refinedstorage.screen.widget.sidebutton.RedstoneModeSideButton;
|
||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataManager;
|
||||
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
import net.minecraft.client.gui.widget.button.Button;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiReaderWriter extends BaseScreen<ReaderWriterContainer> {
|
||||
private static final int VISIBLE_ROWS = 4;
|
||||
|
||||
private static final int ITEM_WIDTH = 143;
|
||||
private static final int ITEM_HEIGHT = 18;
|
||||
|
||||
private List<String> channels = Collections.emptyList();
|
||||
private String currentChannelToSet;
|
||||
|
||||
private Button add;
|
||||
private Button remove;
|
||||
private TextFieldWidget name;
|
||||
private ScrollbarWidget scrollbar;
|
||||
|
||||
private IGuiReaderWriter readerWriter;
|
||||
|
||||
private int itemSelected = -1;
|
||||
private int itemSelectedX = -1;
|
||||
private int itemSelectedY = -1;
|
||||
|
||||
public GuiReaderWriter(ReaderWriterContainer container, IGuiReaderWriter readerWriter, PlayerInventory inventory) {
|
||||
super(container, 176, 209, inventory, null);
|
||||
|
||||
this.readerWriter = readerWriter;
|
||||
this.scrollbar = new ScrollbarWidget(this, 157, 39, 12, 71);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPostInit(int x, int y) {
|
||||
addSideButton(new RedstoneModeSideButton(this, readerWriter.getRedstoneModeParameter()));
|
||||
|
||||
add = addButton(x + 128, y + 15, 20, 20, "+", true, true, btn -> {
|
||||
});
|
||||
|
||||
remove = addButton(x + 150, y + 15, 20, 20, "-", true, true, btn -> {
|
||||
});
|
||||
|
||||
name = new TextFieldWidget(font, x + 8 + 1, y + 20 + 1, 107, font.FONT_HEIGHT, "");
|
||||
name.setEnableBackgroundDrawing(false);
|
||||
name.setVisible(true);
|
||||
name.setTextColor(16777215);
|
||||
name.setCanLoseFocus(true);
|
||||
name.setFocused2(false);
|
||||
}
|
||||
|
||||
private List<String> getChannels() {
|
||||
return readerWriter.isActive() ? channels : Collections.emptyList();
|
||||
}
|
||||
|
||||
public void setChannels(List<String> channels) {
|
||||
this.channels = channels;
|
||||
|
||||
// In case we get the current channel packet earlier than our channel list.
|
||||
if (currentChannelToSet != null) {
|
||||
setCurrentChannel(currentChannelToSet);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(int x, int y) {
|
||||
if (scrollbar != null) {
|
||||
scrollbar.setEnabled(getRows() > VISIBLE_ROWS);
|
||||
scrollbar.setMaxOffset(getRows() - VISIBLE_ROWS);
|
||||
}
|
||||
|
||||
if (itemSelected >= getChannels().size()) {
|
||||
itemSelected = -1;
|
||||
}
|
||||
}
|
||||
|
||||
private int getRows() {
|
||||
return getChannels().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int x, int y, int mouseX, int mouseY) {
|
||||
bindTexture(RS.ID, "gui/readerwriter.png");
|
||||
|
||||
blit(x, y, 0, 0, xSize, ySize);
|
||||
|
||||
if (itemSelectedX != -1 &&
|
||||
itemSelectedY != -1 &&
|
||||
itemSelected >= 0 &&
|
||||
itemSelected < getChannels().size()) {
|
||||
blit(x + itemSelectedX, y + itemSelectedY, 0, 216, ITEM_WIDTH, ITEM_HEIGHT);
|
||||
}
|
||||
|
||||
name.renderButton(0, 0, 0); // TODO is still needed with the new widget stuffs?
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(7, 7, I18n.format(readerWriter.getTitle()));
|
||||
renderString(7, 115, I18n.format("container.inventory"));
|
||||
|
||||
int x = 8;
|
||||
int y = 39;
|
||||
|
||||
int item = scrollbar != null ? scrollbar.getOffset() : 0;
|
||||
|
||||
float scale = Minecraft.getInstance().getForceUnicodeFont() ? 1F : 0.5F;
|
||||
|
||||
for (int i = 0; i < VISIBLE_ROWS; ++i) {
|
||||
if (item < getChannels().size()) {
|
||||
if (item == itemSelected) {
|
||||
itemSelectedX = x;
|
||||
itemSelectedY = y;
|
||||
}
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.scalef(scale, scale, 1);
|
||||
|
||||
renderString(RenderUtils.getOffsetOnScale(x + 5, scale), RenderUtils.getOffsetOnScale(y + 7, scale), getChannels().get(item));
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
y += ITEM_HEIGHT;
|
||||
}
|
||||
|
||||
item++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) {
|
||||
if (super.mouseClicked(mouseX, mouseY, mouseButton)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (name.mouseClicked(mouseX, mouseY, mouseButton)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (RenderUtils.inBounds(8, 39, 144, 73, mouseX - guiLeft, mouseY - guiTop)) {
|
||||
if (mouseButton == 0) {
|
||||
int item = scrollbar != null ? scrollbar.getOffset() : 0;
|
||||
|
||||
for (int i = 0; i < VISIBLE_ROWS; ++i) {
|
||||
int ix = 8;
|
||||
int iy = 39 + (i * ITEM_HEIGHT);
|
||||
|
||||
if (RenderUtils.inBounds(ix, iy, ITEM_WIDTH, ITEM_HEIGHT, mouseX - guiLeft, mouseY - guiTop) && (item + i) < getChannels().size()) {
|
||||
itemSelected = item + i;
|
||||
|
||||
TileDataManager.setParameter(readerWriter.getChannelParameter(), getChannels().get(itemSelected));
|
||||
}
|
||||
}
|
||||
} else if (itemSelected != -1) {
|
||||
TileDataManager.setParameter(readerWriter.getChannelParameter(), "");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* TODO
|
||||
@Override
|
||||
protected void keyTyped(char character, int keyCode) throws IOException {
|
||||
if (keyCode == Keyboard.KEY_DELETE) {
|
||||
onRemove();
|
||||
} else if (name.isFocused() && keyCode == Keyboard.KEY_RETURN) {
|
||||
onAdd();
|
||||
} else if (!checkHotbarKeys(keyCode) && name.textboxKeyTyped(character, keyCode)) {
|
||||
// NO OP
|
||||
} else {
|
||||
super.keyTyped(character, keyCode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton button) throws IOException {
|
||||
super.actionPerformed(button);
|
||||
|
||||
if (button == add) {
|
||||
onAdd();
|
||||
} else if (button == remove) {
|
||||
onRemove();
|
||||
}
|
||||
}*/
|
||||
|
||||
private void onAdd() {
|
||||
String name = this.name.getText().trim();
|
||||
|
||||
if (!name.isEmpty()) {
|
||||
// TODO RS.INSTANCE.network.sendToServer(new MessageReaderWriterChannelAdd(name));
|
||||
}
|
||||
}
|
||||
|
||||
private void onRemove() {
|
||||
String name = this.name.getText().trim();
|
||||
|
||||
if (!name.isEmpty()) {
|
||||
// TODO RS.INSTANCE.network.sendToServer(new MessageReaderWriterChannelRemove(name));
|
||||
}
|
||||
}
|
||||
|
||||
public void setCurrentChannel(String channel) {
|
||||
this.itemSelected = getChannels().indexOf(channel);
|
||||
this.name.setText(itemSelected != -1 ? getChannels().get(itemSelected) : "");
|
||||
this.currentChannelToSet = channel;
|
||||
}
|
||||
}
|
@@ -12,8 +12,6 @@ import com.raoulvdberge.refinedstorage.api.network.grid.handler.IItemGridHandler
|
||||
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
|
||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeProxy;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterListener;
|
||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterManager;
|
||||
import com.raoulvdberge.refinedstorage.api.network.security.ISecurityManager;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.IStorage;
|
||||
@@ -26,14 +24,13 @@ import com.raoulvdberge.refinedstorage.apiimpl.network.NetworkNodeGraph;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.handler.FluidGridHandler;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.handler.ItemGridHandler;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.item.NetworkItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.readerwriter.ReaderWriterManager;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.security.SecurityManager;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.cache.FluidStorageCache;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.cache.ItemStorageCache;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.tracker.FluidStorageTracker;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.tracker.ItemStorageTracker;
|
||||
import com.raoulvdberge.refinedstorage.block.ControllerBlock;
|
||||
import com.raoulvdberge.refinedstorage.integration.forgeenergy.BaseEnergyStorage;
|
||||
import com.raoulvdberge.refinedstorage.energy.BaseEnergyStorage;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.IRedstoneConfigurable;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.RedstoneMode;
|
||||
import com.raoulvdberge.refinedstorage.tile.data.RSSerializers;
|
||||
@@ -134,8 +131,6 @@ public class ControllerTile extends BaseTile implements ITickableTileEntity, INe
|
||||
private IStorageCache<FluidStack> fluidStorage = new FluidStorageCache(this);
|
||||
private FluidStorageTracker fluidStorageTracker = new FluidStorageTracker(this::markDirty);
|
||||
|
||||
private IReaderWriterManager readerWriterManager = new ReaderWriterManager(this);
|
||||
|
||||
private final BaseEnergyStorage energy = new BaseEnergyStorage(RS.SERVER_CONFIG.getController().getCapacity(), RS.SERVER_CONFIG.getController().getMaxTransfer());
|
||||
|
||||
private final LazyOptional<IEnergyStorage> energyProxyCap = LazyOptional.of(() -> energy);
|
||||
@@ -161,17 +156,6 @@ public class ControllerTile extends BaseTile implements ITickableTileEntity, INe
|
||||
dataManager.addParameter(ENERGY_CAPACITY);
|
||||
dataManager.addParameter(NODES);
|
||||
|
||||
readerWriterManager.addListener(new IReaderWriterListener() {
|
||||
@Override
|
||||
public void onAttached() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChanged() {
|
||||
markDirty();
|
||||
}
|
||||
});
|
||||
|
||||
nodeGraph.addListener(() -> dataManager.sendParameterToWatchers(ControllerTile.NODES));
|
||||
}
|
||||
|
||||
@@ -206,8 +190,6 @@ public class ControllerTile extends BaseTile implements ITickableTileEntity, INe
|
||||
if (canRun()) {
|
||||
craftingManager.update();
|
||||
|
||||
readerWriterManager.update();
|
||||
|
||||
if (!craftingManager.getTasks().isEmpty()) {
|
||||
markDirty();
|
||||
}
|
||||
@@ -286,11 +268,6 @@ public class ControllerTile extends BaseTile implements ITickableTileEntity, INe
|
||||
return fluidStorage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IReaderWriterManager getReaderWriterManager() {
|
||||
return readerWriterManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ItemStack insertItem(@Nonnull ItemStack stack, int size, Action action) {
|
||||
@@ -533,8 +510,6 @@ public class ControllerTile extends BaseTile implements ITickableTileEntity, INe
|
||||
|
||||
craftingManager.readFromNbt(tag);
|
||||
|
||||
readerWriterManager.readFromNbt(tag);
|
||||
|
||||
if (tag.contains(NBT_ITEM_STORAGE_TRACKER)) {
|
||||
itemStorageTracker.readFromNbt(tag.getList(NBT_ITEM_STORAGE_TRACKER, Constants.NBT.TAG_COMPOUND));
|
||||
}
|
||||
@@ -554,8 +529,6 @@ public class ControllerTile extends BaseTile implements ITickableTileEntity, INe
|
||||
|
||||
craftingManager.writeToNbt(tag);
|
||||
|
||||
readerWriterManager.writeToNbt(tag);
|
||||
|
||||
tag.put(NBT_ITEM_STORAGE_TRACKER, itemStorageTracker.serializeNbt());
|
||||
tag.put(NBT_FLUID_STORAGE_TRACKER, fluidStorageTracker.serializeNbt());
|
||||
|
||||
|
@@ -1,99 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.tile;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RSTiles;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.IGuiReaderWriter;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeReader;
|
||||
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
|
||||
import com.raoulvdberge.refinedstorage.screen.GuiReaderWriter;
|
||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||
import net.minecraft.network.datasync.DataSerializers;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class TileReader extends NetworkNodeTile<NetworkNodeReader> {
|
||||
static <T extends NetworkNodeTile> TileDataParameter<String, T> createChannelParameter() {
|
||||
return new TileDataParameter<>(DataSerializers.STRING, "", t -> ((IGuiReaderWriter) t.getNode()).getChannel(), (t, v) -> {
|
||||
((IGuiReaderWriter) t.getNode()).setChannel(v);
|
||||
|
||||
t.getNode().markDirty();
|
||||
}, (initial, p) -> BaseScreen.executeLater(GuiReaderWriter.class, readerWriter -> readerWriter.setCurrentChannel(p)));
|
||||
}
|
||||
|
||||
public static final TileDataParameter<String, TileReader> CHANNEL = createChannelParameter();
|
||||
|
||||
public TileReader() {
|
||||
super(RSTiles.READER);
|
||||
|
||||
dataManager.addWatchedParameter(CHANNEL);
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable Direction facing) {
|
||||
if (super.hasCapability(capability, facing)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
IReader reader = getNode();
|
||||
|
||||
if (facing != getDirection()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (IReaderWriterHandlerFactory handlerFactory : API.instance().getReaderWriterHandlerRegistry().all()) {
|
||||
if (handlerFactory.create(null).hasCapabilityReader(reader, capability)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable Direction facing) {
|
||||
T foundCapability = super.getCapability(capability, facing);
|
||||
|
||||
if (foundCapability == null) {
|
||||
IReader reader = getNode();
|
||||
|
||||
if (facing != getDirection()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Object dummyCap = null;
|
||||
for (IReaderWriterHandlerFactory handlerFactory : API.instance().getReaderWriterHandlerRegistry().all()) {
|
||||
if (handlerFactory.create(null).hasCapabilityReader(reader, capability)) {
|
||||
dummyCap = handlerFactory.create(null).getNullCapability();
|
||||
}
|
||||
}
|
||||
|
||||
if (!reader.canUpdate()) {
|
||||
return (T) dummyCap;
|
||||
}
|
||||
|
||||
IReaderWriterChannel channel = reader.getNetwork().getReaderWriterManager().getChannel(reader.getChannel());
|
||||
|
||||
if (channel == null) {
|
||||
return (T) dummyCap;
|
||||
}
|
||||
|
||||
for (IReaderWriterHandler handler : channel.getHandlers()) {
|
||||
foundCapability = handler.getCapabilityReader(reader, capability);
|
||||
|
||||
if (foundCapability != null) {
|
||||
return foundCapability;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return foundCapability;
|
||||
}*/
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public NetworkNodeReader createNode(World world, BlockPos pos) {
|
||||
return new NetworkNodeReader(world, pos);
|
||||
}
|
||||
}
|
@@ -1,87 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.tile;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RSTiles;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeWriter;
|
||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class TileWriter extends NetworkNodeTile<NetworkNodeWriter> {
|
||||
public static final TileDataParameter<String, TileWriter> CHANNEL = TileReader.createChannelParameter();
|
||||
|
||||
public TileWriter() {
|
||||
super(RSTiles.WRITER);
|
||||
|
||||
dataManager.addWatchedParameter(CHANNEL);
|
||||
}
|
||||
|
||||
/* TODO
|
||||
@Override
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable Direction facing) {
|
||||
if (super.hasCapability(capability, facing)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
IWriter writer = getNode();
|
||||
|
||||
if (facing != getDirection()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (IReaderWriterHandlerFactory handlerFactory : API.instance().getReaderWriterHandlerRegistry().all()) {
|
||||
if (handlerFactory.create(null).hasCapabilityWriter(writer, capability)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable Direction facing) {
|
||||
T foundCapability = super.getCapability(capability, facing);
|
||||
|
||||
if (foundCapability == null) {
|
||||
IWriter writer = getNode();
|
||||
|
||||
if (facing != getDirection()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Object dummyCap = null;
|
||||
for (IReaderWriterHandlerFactory handlerFactory : API.instance().getReaderWriterHandlerRegistry().all()) {
|
||||
if (handlerFactory.create(null).hasCapabilityWriter(writer, capability)) {
|
||||
dummyCap = handlerFactory.create(null).getNullCapability();
|
||||
}
|
||||
}
|
||||
|
||||
if (!writer.canUpdate()) {
|
||||
return (T) dummyCap;
|
||||
}
|
||||
|
||||
IReaderWriterChannel channel = writer.getNetwork().getReaderWriterManager().getChannel(writer.getChannel());
|
||||
|
||||
if (channel == null) {
|
||||
return (T) dummyCap;
|
||||
}
|
||||
|
||||
for (IReaderWriterHandler handler : channel.getHandlers()) {
|
||||
foundCapability = handler.getCapabilityWriter(writer, capability);
|
||||
|
||||
if (foundCapability != null) {
|
||||
return foundCapability;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return foundCapability;
|
||||
}*/
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public NetworkNodeWriter createNode(World world, BlockPos pos) {
|
||||
return new NetworkNodeWriter(world, pos);
|
||||
}
|
||||
}
|
@@ -1,98 +0,0 @@
|
||||
{
|
||||
"forge_marker": 1,
|
||||
"defaults": {
|
||||
"textures": {
|
||||
"cable": "refinedstorage:blocks/cable",
|
||||
"particle": "refinedstorage:blocks/cable",
|
||||
"front": "refinedstorage:blocks/reader/reader",
|
||||
"cutout": "refinedstorage:blocks/reader/cutouts/disconnected",
|
||||
"border": "refinedstorage:blocks/cable_part_border"
|
||||
},
|
||||
"model": "refinedstorage:cable_core",
|
||||
"uvlock": true,
|
||||
"transform": "forge:default-block"
|
||||
},
|
||||
"variants": {
|
||||
"connected": {
|
||||
"true": {
|
||||
"textures": {
|
||||
"cutout": "refinedstorage:blocks/reader/cutouts/connected"
|
||||
}
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"direction": {
|
||||
"north": {
|
||||
"submodel": "refinedstorage:constructor_destructor"
|
||||
},
|
||||
"east": {
|
||||
"submodel": "refinedstorage:constructor_destructor",
|
||||
"y": 90
|
||||
},
|
||||
"south": {
|
||||
"submodel": "refinedstorage:constructor_destructor",
|
||||
"x": 180
|
||||
},
|
||||
"west": {
|
||||
"submodel": "refinedstorage:constructor_destructor",
|
||||
"y": 270
|
||||
},
|
||||
"up": {
|
||||
"submodel": "refinedstorage:constructor_destructor",
|
||||
"x": 270
|
||||
},
|
||||
"down": {
|
||||
"submodel": "refinedstorage:constructor_destructor",
|
||||
"x": 90
|
||||
}
|
||||
},
|
||||
"north": {
|
||||
"true": {
|
||||
"submodel": "refinedstorage:cable_extension"
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"east": {
|
||||
"true": {
|
||||
"submodel": "refinedstorage:cable_extension",
|
||||
"y": 90
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"south": {
|
||||
"true": {
|
||||
"submodel": "refinedstorage:cable_extension",
|
||||
"x": 180
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"west": {
|
||||
"true": {
|
||||
"submodel": "refinedstorage:cable_extension",
|
||||
"y": 270
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"up": {
|
||||
"true": {
|
||||
"submodel": "refinedstorage:cable_extension",
|
||||
"x": 270
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"down": {
|
||||
"true": {
|
||||
"submodel": "refinedstorage:cable_extension",
|
||||
"x": 90
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,98 +0,0 @@
|
||||
{
|
||||
"forge_marker": 1,
|
||||
"defaults": {
|
||||
"textures": {
|
||||
"cable": "refinedstorage:blocks/cable",
|
||||
"particle": "refinedstorage:blocks/cable",
|
||||
"front": "refinedstorage:blocks/writer/writer",
|
||||
"cutout": "refinedstorage:blocks/writer/cutouts/disconnected",
|
||||
"border": "refinedstorage:blocks/cable_part_border"
|
||||
},
|
||||
"model": "refinedstorage:cable_core",
|
||||
"uvlock": true,
|
||||
"transform": "forge:default-block"
|
||||
},
|
||||
"variants": {
|
||||
"connected": {
|
||||
"true": {
|
||||
"textures": {
|
||||
"cutout": "refinedstorage:blocks/writer/cutouts/connected"
|
||||
}
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"direction": {
|
||||
"north": {
|
||||
"submodel": "refinedstorage:constructor_destructor"
|
||||
},
|
||||
"east": {
|
||||
"submodel": "refinedstorage:constructor_destructor",
|
||||
"y": 90
|
||||
},
|
||||
"south": {
|
||||
"submodel": "refinedstorage:constructor_destructor",
|
||||
"x": 180
|
||||
},
|
||||
"west": {
|
||||
"submodel": "refinedstorage:constructor_destructor",
|
||||
"y": 270
|
||||
},
|
||||
"up": {
|
||||
"submodel": "refinedstorage:constructor_destructor",
|
||||
"x": 270
|
||||
},
|
||||
"down": {
|
||||
"submodel": "refinedstorage:constructor_destructor",
|
||||
"x": 90
|
||||
}
|
||||
},
|
||||
"north": {
|
||||
"true": {
|
||||
"submodel": "refinedstorage:cable_extension"
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"east": {
|
||||
"true": {
|
||||
"submodel": "refinedstorage:cable_extension",
|
||||
"y": 90
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"south": {
|
||||
"true": {
|
||||
"submodel": "refinedstorage:cable_extension",
|
||||
"x": 180
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"west": {
|
||||
"true": {
|
||||
"submodel": "refinedstorage:cable_extension",
|
||||
"y": 270
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"up": {
|
||||
"true": {
|
||||
"submodel": "refinedstorage:cable_extension",
|
||||
"x": 270
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"down": {
|
||||
"true": {
|
||||
"submodel": "refinedstorage:cable_extension",
|
||||
"x": 90
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -66,8 +66,6 @@
|
||||
"gui.refinedstorage:crafting_preview.error.recursive.4": "Offending pattern:",
|
||||
"gui.refinedstorage:crafting_preview.error.too_complex.0": "The crafting task calculation was too complex",
|
||||
"gui.refinedstorage:crafting_preview.error.too_complex.1": "and was stopped to avoid server strain.",
|
||||
"gui.refinedstorage:reader": "Reader",
|
||||
"gui.refinedstorage:writer": "Writer",
|
||||
"gui.refinedstorage:security_manager": "Security Manager",
|
||||
"gui.refinedstorage:security_manager.configure": "Configure",
|
||||
"gui.refinedstorage.security_manager.permission.0": "Insert",
|
||||
@@ -108,7 +106,6 @@
|
||||
"misc.refinedstorage.priority": "Priority",
|
||||
"misc.refinedstorage:oredict": "Oredict",
|
||||
"misc.refinedstorage.processing": "Processing",
|
||||
"misc.refinedstorage:reader_writer.redstone": "Redstone strength: %d",
|
||||
"misc.refinedstorage.total": "%s total",
|
||||
"misc.refinedstorage.last_modified.just_now": "Last modified just now by %s",
|
||||
"misc.refinedstorage.last_modified.second": "Last modified %d second ago by %s",
|
||||
@@ -212,8 +209,6 @@
|
||||
"block.refinedstorage.1024k_fluid_storage_block": "1024k Fluid Storage Block",
|
||||
"block.refinedstorage.4096k_fluid_storage_block": "4096k Fluid Storage Block",
|
||||
"block.refinedstorage.creative_fluid_storage_block": "Creative Fluid Storage Block",
|
||||
"block.refinedstorage:reader": "Reader",
|
||||
"block.refinedstorage:writer": "Writer",
|
||||
"block.refinedstorage:security_manager": "Security Manager",
|
||||
"block.refinedstorage.quartz_enriched_iron_block": "Block of Quartz Enriched Iron",
|
||||
"block.refinedstorage:storage_monitor": "Storage Monitor",
|
||||
|
@@ -1,28 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"EDE",
|
||||
"RMR",
|
||||
"EIE"
|
||||
],
|
||||
"key": {
|
||||
"E": {
|
||||
"item": "refinedstorage:quartz_enriched_iron"
|
||||
},
|
||||
"D": {
|
||||
"item": "#destruction_core"
|
||||
},
|
||||
"R": {
|
||||
"item": "minecraft:redstone"
|
||||
},
|
||||
"M": {
|
||||
"item": "refinedstorage:cable"
|
||||
},
|
||||
"I": {
|
||||
"item": "#advanced_processor"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "refinedstorage:reader"
|
||||
}
|
||||
}
|
@@ -1,28 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"ECE",
|
||||
"RMR",
|
||||
"EIE"
|
||||
],
|
||||
"key": {
|
||||
"E": {
|
||||
"item": "refinedstorage:quartz_enriched_iron"
|
||||
},
|
||||
"C": {
|
||||
"item": "#construction_core"
|
||||
},
|
||||
"R": {
|
||||
"item": "minecraft:redstone"
|
||||
},
|
||||
"M": {
|
||||
"item": "refinedstorage:cable"
|
||||
},
|
||||
"I": {
|
||||
"item": "#advanced_processor"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "refinedstorage:writer"
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 336 B |
Before Width: | Height: | Size: 247 B |
Before Width: | Height: | Size: 582 B |
Before Width: | Height: | Size: 334 B |
Before Width: | Height: | Size: 247 B |
Before Width: | Height: | Size: 594 B |
Before Width: | Height: | Size: 1.8 KiB |