Even more Baubles

* Baubles slots are now displayed in the Capacitor Bank. So the Magnet can be charged directly.
This commit is contained in:
Henry Loenwind authored and HenryLoenwind committed 2015-04-30 00:21:25 +02:00
1 parent d4360e2b59
commit ebec0bee6c
5 files changed
+177 -6

No files matched your search

@@ -1,12 +1,43 @@
package crazypants.util;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import baubles.api.BaublesApi;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.relauncher.Side;
public class BaublesUtil {
public static enum WhoAmI {
SPCLIENT, MPCLIENT, SPSERVER, MPSERVER, OTHER;
public static BaublesUtil.WhoAmI whoAmI(World world) {
Side side = FMLCommonHandler.instance().getSide();
if (side == Side.CLIENT) {
if (Minecraft.getMinecraft().isIntegratedServerRunning()) {
if (world.isRemote) {
return SPCLIENT;
} else {
return SPSERVER;
}
} else {
return MPCLIENT;
}
} else if (side == Side.SERVER) {
if (MinecraftServer.getServer().isDedicatedServer()) {
return MPSERVER;
} else if (Minecraft.getMinecraft().isIntegratedServerRunning()) {
return SPSERVER;
}
}
return OTHER;
}
}
private static final BaublesUtil instance = new BaublesUtil();
private static final boolean baublesLoaded;
static {
@@ -24,6 +55,11 @@ public class BaublesUtil {
return baublesLoaded;
}
/**
* Do NOT modify this inventory on the client side of a singleplayer game!
*
* Wrap it in a ShadowInventory if you need to.
*/
public IInventory getBaubles(EntityPlayer player) {
return hasBaubles() ? getBaublesInvUnsafe(player) : null;
}
@@ -31,4 +67,5 @@ public class BaublesUtil {
private IInventory getBaublesInvUnsafe(EntityPlayer player) {
return BaublesApi.getBaubles(player);
}
}