Created
July 13, 2017 13:52
-
-
Save Keridos/02f657e2f403ffa8b838944c5af85ffd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import li.cil.oc.api.Driver; | |
import li.cil.oc.api.network.ManagedEnvironment; | |
import li.cil.oc.api.prefab.DriverSidedTileEntity; | |
import net.minecraft.util.EnumFacing; | |
import net.minecraft.util.math.BlockPos; | |
import net.minecraft.world.World; | |
/** | |
* Created by nico on 09/06/17. | |
*/ | |
public abstract class AbstractOMDriver { | |
private static DriverSidedTEWrapper wrapper; | |
private class DriverSidedTEWrapper extends DriverSidedTileEntity { | |
@Override | |
public Class<?> getTileEntityClass() { | |
return clGetTileEntityClass(); | |
} | |
@Override | |
public ManagedEnvironment createEnvironment(World world, BlockPos pos, EnumFacing side) { | |
return clCreateEnvironment(world, pos, side); | |
} | |
} | |
protected abstract Class<?> clGetTileEntityClass(); | |
protected abstract ManagedEnvironment clCreateEnvironment(World world, BlockPos pos, EnumFacing side); | |
public void registerWrapper() { | |
if (wrapper == null) { | |
wrapper = new AbstractOMDriver.DriverSidedTEWrapper(); | |
} | |
Driver.add(wrapper); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment