mirror of
				https://github.com/SquidDev-CC/CC-Tweaked
				synced 2025-10-30 21:23:00 +00:00 
			
		
		
		
	Make generic peripherals on by default
This is a long way away from "feature complete" as it were. However, it's definitely at a point where it's suitable for general usage - I'm happy with the API, and don't think I'm going to be breaking things any time soon. That said, things aren't exposed yet for Java-side public consumption. I was kinda waiting until working on Plethora to actually do that, but not sure if/when that'll happen. If someone else wants to work on an integration mod (or just adding integrations for their own mod), do get in touch and I can work out how to expose this. Closes #452
This commit is contained in:
		| @@ -90,8 +90,6 @@ public final class ComputerCraft | |||||||
|     public static boolean turtlesCanPush = true; |     public static boolean turtlesCanPush = true; | ||||||
|     public static EnumSet<TurtleAction> turtleDisabledActions = EnumSet.noneOf( TurtleAction.class ); |     public static EnumSet<TurtleAction> turtleDisabledActions = EnumSet.noneOf( TurtleAction.class ); | ||||||
|  |  | ||||||
|     public static boolean genericPeripheral = false; |  | ||||||
|  |  | ||||||
|     public static int computerTermWidth = 51; |     public static int computerTermWidth = 51; | ||||||
|     public static int computerTermHeight = 19; |     public static int computerTermHeight = 19; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -82,8 +82,6 @@ public final class Config | |||||||
|     private static final ConfigValue<Integer> monitorWidth; |     private static final ConfigValue<Integer> monitorWidth; | ||||||
|     private static final ConfigValue<Integer> monitorHeight; |     private static final ConfigValue<Integer> monitorHeight; | ||||||
|  |  | ||||||
|     private static final ConfigValue<Boolean> genericPeripheral; |  | ||||||
|  |  | ||||||
|     private static final ConfigValue<MonitorRenderer> monitorRenderer; |     private static final ConfigValue<MonitorRenderer> monitorRenderer; | ||||||
|     private static final ConfigValue<Integer> monitorDistance; |     private static final ConfigValue<Integer> monitorDistance; | ||||||
|  |  | ||||||
| @@ -294,17 +292,6 @@ public final class Config | |||||||
|             builder.pop(); |             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(); |         serverSpec = builder.build(); | ||||||
|  |  | ||||||
|         Builder clientBuilder = new Builder(); |         Builder clientBuilder = new Builder(); | ||||||
| @@ -379,9 +366,6 @@ public final class Config | |||||||
|         ComputerCraft.monitorWidth = monitorWidth.get(); |         ComputerCraft.monitorWidth = monitorWidth.get(); | ||||||
|         ComputerCraft.monitorHeight = monitorHeight.get(); |         ComputerCraft.monitorHeight = monitorHeight.get(); | ||||||
|  |  | ||||||
|         // Experimental |  | ||||||
|         ComputerCraft.genericPeripheral = genericPeripheral.get(); |  | ||||||
|  |  | ||||||
|         // Client |         // Client | ||||||
|         ComputerCraft.monitorRenderer = monitorRenderer.get(); |         ComputerCraft.monitorRenderer = monitorRenderer.get(); | ||||||
|         ComputerCraft.monitorDistanceSq = monitorDistance.get() * monitorDistance.get(); |         ComputerCraft.monitorDistanceSq = monitorDistance.get() * monitorDistance.get(); | ||||||
|   | |||||||
| @@ -35,8 +35,6 @@ public class GenericPeripheralProvider | |||||||
|     @Nonnull |     @Nonnull | ||||||
|     public static LazyOptional<IPeripheral> getPeripheral( @Nonnull World world, @Nonnull BlockPos pos, @Nonnull Direction side ) |     public static LazyOptional<IPeripheral> getPeripheral( @Nonnull World world, @Nonnull BlockPos pos, @Nonnull Direction side ) | ||||||
|     { |     { | ||||||
|         if( !ComputerCraft.genericPeripheral ) return LazyOptional.empty(); |  | ||||||
|  |  | ||||||
|         TileEntity tile = world.getTileEntity( pos ); |         TileEntity tile = world.getTileEntity( pos ); | ||||||
|         if( tile == null ) return LazyOptional.empty(); |         if( tile == null ) return LazyOptional.empty(); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -26,9 +26,6 @@ import java.util.stream.Collectors; | |||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Data providers for items. |  * Data providers for items. | ||||||
|  * |  | ||||||
|  * We guard using {@link ComputerCraft#genericPeripheral} in several places, as advanced functionality should not be |  | ||||||
|  * exposed for {@code turtle.getItemDetail} when generic peripehrals are disabled. |  | ||||||
|  */ |  */ | ||||||
| public class ItemData | public class ItemData | ||||||
| { | { | ||||||
| @@ -73,8 +70,6 @@ public class ItemData | |||||||
|  |  | ||||||
|         data.put( "tags", DataHelpers.getTags( stack.getItem().getTags() ) ); |         data.put( "tags", DataHelpers.getTags( stack.getItem().getTags() ) ); | ||||||
|  |  | ||||||
|         if( !ComputerCraft.genericPeripheral ) return data; |  | ||||||
|  |  | ||||||
|         CompoundNBT tag = stack.getTag(); |         CompoundNBT tag = stack.getTag(); | ||||||
|         if( tag != null && tag.contains( "display", Constants.NBT.TAG_COMPOUND ) ) |         if( tag != null && tag.contains( "display", Constants.NBT.TAG_COMPOUND ) ) | ||||||
|         { |         { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 SquidDev
					SquidDev