Skip to content

Commit

Permalink
Fix up waila
Browse files Browse the repository at this point in the history
  • Loading branch information
Victorious3 committed Aug 8, 2015
1 parent 4951479 commit ba3a0d9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.launchwrapper.Launch;
import net.minecraft.launchwrapper.LaunchClassLoader;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

Expand All @@ -41,7 +40,6 @@
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.ModAPIManager;
import cpw.mods.fml.common.ModClassLoader;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
Expand Down Expand Up @@ -87,10 +85,6 @@ public class IntegratedCircuits {
public void preInit(FMLPreInitializationEvent event) throws Exception {
developmentEnvironment = (Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment");

Field transformers = LaunchClassLoader.class.getDeclaredField("transformers");
transformers.setAccessible(true);
System.out.println(transformers.get(ModClassLoader.class.getClassLoader()));

// Initialize API
Field apiField = IntegratedCircuitsAPI.class.getDeclaredField("instance");
apiField.setAccessible(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static void registerAddon(IWailaRegistrar register) {

register.registerStackProvider(instance, BlockSocket.class);
register.registerBodyProvider(instance, BlockSocket.class);
register.registerBodyProvider(instance, Constants.MOD_ID + "_circuit");
register.registerBodyProvider(instance, Constants.MOD_ID + ".socket_fmp");
}

@Override
Expand All @@ -38,8 +38,6 @@ public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler
}

private List<String> getCircuitInformation(ItemStack circuit, List<String> currenttip) {
if (circuit.getTagCompound() == null)
return currenttip;
NBTTagCompound circuitTag = circuit.getTagCompound().getCompoundTag("circuit");
NBTTagCompound properties = circuitTag.getCompoundTag("properties");
currenttip.add(EnumChatFormatting.GOLD + "Name: " + EnumChatFormatting.RESET + properties.getString("name"));
Expand All @@ -65,13 +63,13 @@ public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, I
}

@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
TileEntitySocket te = (TileEntitySocket) accessor.getTileEntity();
if (te.getSocket().getGate() instanceof GateCircuit)
return getCircuitInformation(itemStack, currenttip);
else
else {
return currenttip;
}
}

@Override
Expand All @@ -95,7 +93,12 @@ public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, I
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaFMPAccessor accessor,
IWailaConfigHandler config) {
return getCircuitInformation(itemStack, currenttip);

if (itemStack.getTagCompound() != null) {
return getCircuitInformation(itemStack, currenttip);
} else {
return currenttip;
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ public Iterable<ItemStack> getDrops() {

@Override
public ItemStack pickItem(MovingObjectPosition hit) {
return socket.pickItem(hit);
ItemStack stack = socket.pickItem(hit);
if (stack == null)
stack = new ItemStack(Content.itemSocketFMP);
return stack;
}

@Override
Expand Down

0 comments on commit ba3a0d9

Please sign in to comment.