Skip to content

Commit

Permalink
Merge pull request #42 from GTNewHorizons/oc-api
Browse files Browse the repository at this point in the history
fix no environement return
  • Loading branch information
Dream-Master authored Nov 24, 2022
2 parents 7f69334 + b02ac62 commit 9b99273
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public boolean worksWith(World world, int x, int y, int z, ForgeDirection side)

@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 {
Expand Down Expand Up @@ -110,6 +111,18 @@ private static boolean isDualFluidInterface(TileEntity te, ForgeDirection face)
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() {
}
Expand Down

0 comments on commit 9b99273

Please sign in to comment.