mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2026-10-19 22:12:28 +00:00
Generic peripherals for any tile entities (#478)
This exposes a basic peripheral for any tile entity which does not have methods already registered. We currently provide the following methods: - Inventories: size, list, getItemMeta, pushItems, pullItems. - Energy storage: getEnergy, getEnergyCapacity - Fluid tanks: tanks(), pushFluid, pullFluid. These methods are currently experimental - it must be enabled through `experimental.generic_peripherals`. While this is an initial step towards implementing #452, but is by no means complete.
This commit is contained in:
@@ -73,6 +73,8 @@ public final class Config
|
||||
private static final ConfigValue<Boolean> turtlesCanPush;
|
||||
private static final ConfigValue<List<? extends String>> turtleDisabledActions;
|
||||
|
||||
private static final ConfigValue<Boolean> genericPeripheral;
|
||||
|
||||
private static final ConfigValue<MonitorRenderer> monitorRenderer;
|
||||
|
||||
private static final ForgeConfigSpec serverSpec;
|
||||
@@ -260,6 +262,17 @@ public final class Config
|
||||
builder.pop();
|
||||
}
|
||||
|
||||
{
|
||||
builder.comment( "Options for various experimental features. These are not guaranteed to be stable, and may change or be removed across versions." );
|
||||
builder.push( "experimental" );
|
||||
|
||||
genericPeripheral = builder
|
||||
.comment( "Attempt to make any existing block (or tile entity) a peripheral.\n" +
|
||||
"This provides peripheral methods for any inventory, fluid tank or energy storage block. It will" +
|
||||
"_not_ provide methods which have an existing peripheral provider." )
|
||||
.define( "generic_peripherals", false );
|
||||
}
|
||||
|
||||
serverSpec = builder.build();
|
||||
|
||||
Builder clientBuilder = new Builder();
|
||||
@@ -322,6 +335,8 @@ public final class Config
|
||||
ComputerCraft.turtleDisabledActions.clear();
|
||||
for( String value : turtleDisabledActions.get() ) ComputerCraft.turtleDisabledActions.add( getAction( value ) );
|
||||
|
||||
ComputerCraft.genericPeripheral = genericPeripheral.get();
|
||||
|
||||
// Client
|
||||
ComputerCraft.monitorRenderer = monitorRenderer.get();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user