Merge pull request #42 from GTNewHorizons/oc-api

fix no environement return
This commit is contained in:
Martin Robertz authored and GitHub committed 2022-11-24 13:34:52 +01:00
commit 9b992731c2
1 file changed
+14 -1
@@ -34,7 +34,8 @@ public class DriverDualFluidInterface implements SidedBlock {
@Override
public ManagedEnvironment createEnvironment(World world, int x, int y, int z, ForgeDirection side) {
return null;
TileEntity te = world.getTileEntity(x, y, z);
return new DriverDualFluidInterface.Environment(getInterface(te, side));
}
public static class Environment extends ManagedTileEntityEnvironment<DualityFluidInterface> implements NamedBlock {
@@ -110,6 +111,18 @@ public class DriverDualFluidInterface implements SidedBlock {
return false;
}
private static DualityFluidInterface getInterface(TileEntity te, ForgeDirection face) {
if (te != null) {
if (te instanceof TileFluidInterface) {
return ((TileFluidInterface) te).getDualityFluid();
}
if (te instanceof IPartHost && ((IPartHost) te).getPart(face) instanceof PartFluidInterface) {
return ((PartFluidInterface) ((IPartHost) te).getPart(face)).getDualityFluid();
}
}
return null;
}
public static class Provider implements EnvironmentProvider {
Provider() {
}