diff --git a/src/main/java/dan200/computercraft/ComputerCraft.java b/src/main/java/dan200/computercraft/ComputerCraft.java index fe522ed8a..6332348c3 100644 --- a/src/main/java/dan200/computercraft/ComputerCraft.java +++ b/src/main/java/dan200/computercraft/ComputerCraft.java @@ -16,15 +16,10 @@ import dan200.computercraft.shared.peripheral.monitor.MonitorRenderer; import dan200.computercraft.shared.pocket.peripherals.PocketModem; import dan200.computercraft.shared.pocket.peripherals.PocketSpeaker; import dan200.computercraft.shared.turtle.upgrades.*; -import net.minecraft.resources.IReloadableResourceManager; -import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.server.ServerLifecycleHooks; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import java.io.IOException; -import java.io.InputStream; import java.util.Collections; import java.util.EnumSet; import java.util.List; @@ -140,16 +135,4 @@ public final class ComputerCraft Registry.setup(); } - public static InputStream getResourceFile( String domain, String subPath ) - { - IReloadableResourceManager manager = ServerLifecycleHooks.getCurrentServer().getResourceManager(); - try - { - return manager.getResource( new ResourceLocation( domain, subPath ) ).getInputStream(); - } - catch( IOException ignored ) - { - return null; - } - } } diff --git a/src/main/java/dan200/computercraft/ComputerCraftAPIImpl.java b/src/main/java/dan200/computercraft/ComputerCraftAPIImpl.java index 28f6d4e71..dcd2c5bdb 100644 --- a/src/main/java/dan200/computercraft/ComputerCraftAPIImpl.java +++ b/src/main/java/dan200/computercraft/ComputerCraftAPIImpl.java @@ -27,6 +27,7 @@ import dan200.computercraft.shared.wired.WiredNode; import net.minecraft.resources.IReloadableResourceManager; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; @@ -36,6 +37,8 @@ import net.minecraftforge.fml.server.ServerLifecycleHooks; import javax.annotation.Nonnull; import java.io.File; +import java.io.IOException; +import java.io.InputStream; import static dan200.computercraft.shared.Capabilities.CAPABILITY_WIRED_ELEMENT; @@ -49,6 +52,19 @@ public final class ComputerCraftAPIImpl implements IComputerCraftAPI { } + public static InputStream getResourceFile( String domain, String subPath ) + { + IReloadableResourceManager manager = ServerLifecycleHooks.getCurrentServer().getResourceManager(); + try + { + return manager.getResource( new ResourceLocation( domain, subPath ) ).getInputStream(); + } + catch( IOException ignored ) + { + return null; + } + } + @Nonnull @Override public String getInstalledVersion() diff --git a/src/main/java/dan200/computercraft/shared/computer/core/ServerComputer.java b/src/main/java/dan200/computercraft/shared/computer/core/ServerComputer.java index 3b2959ca6..6026eed98 100644 --- a/src/main/java/dan200/computercraft/shared/computer/core/ServerComputer.java +++ b/src/main/java/dan200/computercraft/shared/computer/core/ServerComputer.java @@ -6,6 +6,7 @@ package dan200.computercraft.shared.computer.core; import dan200.computercraft.ComputerCraft; +import dan200.computercraft.ComputerCraftAPIImpl; import dan200.computercraft.api.ComputerCraftAPI; import dan200.computercraft.api.filesystem.IMount; import dan200.computercraft.api.filesystem.IWritableMount; @@ -333,7 +334,7 @@ public class ServerComputer extends ServerTerminal implements IComputer, IComput @Override public InputStream createResourceFile( String domain, String subPath ) { - return ComputerCraft.getResourceFile( domain, subPath ); + return ComputerCraftAPIImpl.getResourceFile( domain, subPath ); } @Override