Here's an example of what would work and would not work. Assume that the optional mod has an EntityVampire and in your mod if the other mod is loaded you want to spawn vampires, but if the other mod is not loaded then you want to spawn EntityWitch.
Proper Encapsulation Example
For proper encapsulation, the interface is designed so that the dummy implementation doesn't see any classes it won't have. For example, in your proxy interface you could have a method called spawnEvilEntity() that is prototyped like this:
void spawnEvilEntity(World worldIn, BlockPos posIn);
Then in your dummy proxy implementation class you implement the method as:
public void spawnEvilEntity(World worldIn, BlockPos posIn)
{
EntityWitch entity = new EntityWitch(worldIn);
entity.setLocationAndAngles(posIn);
worldIn.spawnEntity(entity);
}
And in your active mod proxy implementation class you implement the method as:
public void spawnEvilEntity(World worldIn, BlockPos posIn)
{
EntityVampire entity = new EntityVampire(worldIn);
entity.setLocationAndAngles(posIn);
worldIn.spawnEntity(entity);
}
Then you could use this in your main mod code whenever you want to spawn one of these you just call:
proxy.spawnEvilEntity(theWorld, thePos);
Wrong Way
If you expose any classes from the optional mod to the interface it will cause trouble. For example, if instead of actually spawning the mob, if you made a method called createVampire() in your proxy interface like:
EntityVampire createVampire(World worldIn, BlockPos posIn);
And in your dummy proxy you had:
public EntityVampire createVampire(World worldIn, BlockPos posIn)
{
return null;
}
And in your active mod proxy you had:
public EntityVampire createVampire(World worldIn, BlockPos posIn)
{
EntityVampire entity = new EntityVampire(worldIn);
entity.setLocationAndAngles(posIn);
return entity;
}
In which case you might try to use it this way in your main mod:
EntityVampire vampire = proxy.createVampire(theWorld, thePos);
if (vampire != null)
{
theWorld.spawn(vampire);
}
else
{
EntityWitch witch = new EntityWitch(worldIn);
witch.setLocationAndAngles(posIn);
theWorld.spawn(witch);
}
This will fail because you have your main mod trying to access EntityVampire which may not be available.
Not sure if my example is clear but the point is that you need to organize your proxy code so that all the code that depends on the classes from the optional mod are ONLY accessed within the active mod proxy implementation. You cannot expose those classes to the dummy proxy or the rest of your mod.
If you get more specific on what you're trying to do, we can give more specific examples.