mirror of
https://github.com/GTNewHorizons/MagicBees.git
synced 2026-11-17 19:15:05 +00:00
Shit, I did it again.
Cleaning up old TC3 stuff, preparing to try integrating TC4. Cleaning up helper stuff so it is more consistent & straightforward.
This commit is contained in:
1 parent
e23ebd1011
commit
3d75e97b20
39 files changed
+513
-973
No files matched your search
@@ -0,0 +1,63 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import magicbees.api.MagicBeesAPI;
|
||||
import magicbees.api.bees.ITransmutationEffectController;
|
||||
import magicbees.api.bees.ITransmutationEffectLogic;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
public class TransmutationEffectController implements ITransmutationEffectController
|
||||
{
|
||||
private ArrayList<ITransmutationEffectLogic> logicObjects;
|
||||
static TransmutationEffectController instance;
|
||||
|
||||
public TransmutationEffectController()
|
||||
{
|
||||
logicObjects = new ArrayList<ITransmutationEffectLogic>();
|
||||
logicObjects.add(new TransmutationEffectRailcraft());
|
||||
logicObjects.add(new TransmutationEffectVanilla());
|
||||
MagicBeesAPI.transmutationEffectController = instance = this;
|
||||
}
|
||||
|
||||
public void attemptTransmutations(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z)
|
||||
{
|
||||
boolean done = false;
|
||||
int i = 0;
|
||||
ITransmutationEffectLogic logic;
|
||||
while (!done && i < logicObjects.size())
|
||||
{
|
||||
logic = logicObjects.get(i++);
|
||||
try
|
||||
{
|
||||
done = logic.tryTransmutation(world, biome, sourceBlock, x, y, z);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
done = false;
|
||||
FMLLog.warning("Magic Bees encountered an issue with an ITransmutationEffectLogic provider %s. Debug information follows.", logic.getClass().getName());
|
||||
FMLLog.info(e.getMessage());
|
||||
}
|
||||
|
||||
if (done)
|
||||
{
|
||||
logicObjects.remove(i);
|
||||
logicObjects.add(logic);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEffectLogic(ITransmutationEffectLogic logic)
|
||||
{
|
||||
if (logic != null && !logicObjects.contains(logic))
|
||||
{
|
||||
logicObjects.add(logic);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user