1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-10-31 21:52:59 +00:00

Even more proxy pruning

- Move the "world directory" getter out of the proxy - we can just use
   Forge's code here.
 - Remove the server proxies, as both were empty. We don't tend to
   register any dedicated-server specific code, so I think we can leave
   them out.
This commit is contained in:
SquidDev
2019-01-12 18:20:16 +00:00
parent 63691707fc
commit 1c648850ab
9 changed files with 37 additions and 64 deletions

View File

@@ -19,7 +19,6 @@ import net.minecraftforge.common.util.Constants;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.File;
import java.util.Collections;
import java.util.Map;
@@ -66,10 +65,7 @@ public final class WiredModemLocalPeripheral
else if( id < 0 || !type.equals( this.type ) )
{
this.type = type;
this.id = IDAssigner.getNextIDFromFile( new File(
ComputerCraft.getWorldDir( world ),
"computer/lastid_" + type + ".txt"
) );
this.id = IDAssigner.getNextIDFromFile( "computer/lastid_" + type + ".txt" );
}
return oldPeripheral == null || !oldPeripheral.equals( peripheral );

View File

@@ -11,7 +11,7 @@ import dan200.computercraft.shared.turtle.core.TurtlePlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.EntityRegistry;
public abstract class CCTurtleProxyCommon implements ICCTurtleProxy
public class CCTurtleProxyCommon implements ICCTurtleProxy
{
@Override
public void preInit()

View File

@@ -63,7 +63,7 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import pl.asie.charset.ModCharset;
public abstract class ComputerCraftProxyCommon implements IComputerCraftProxy
public class ComputerCraftProxyCommon implements IComputerCraftProxy
{
@Override
public void preInit()

View File

@@ -10,9 +10,6 @@ import dan200.computercraft.shared.command.text.TableBuilder;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import java.io.File;
public interface IComputerCraftProxy
{
@@ -22,8 +19,6 @@ public interface IComputerCraftProxy
void initServer( MinecraftServer server );
File getWorldDir( World world );
default void playRecordClient( BlockPos pos, SoundEvent record, String info )
{
}

View File

@@ -17,6 +17,16 @@ public class IDAssigner
{
}
public static int getNextIDFromDirectory( String path )
{
return getNextIDFromDirectory( new File( ComputerCraft.getWorldDir(), path ) );
}
public static int getNextIDFromFile( String path )
{
return getNextIDFromFile( new File( ComputerCraft.getWorldDir(), path ) );
}
public static int getNextIDFromDirectory( File dir )
{
return getNextID( dir, true );