Fixing the peripheral.wrap issue with CC 1.63

Tested sucessfuly with Teleporters, Digital Miners and Factories.
This commit is contained in:
Richie 2014-04-28 19:34:41 +02:00
parent 49cb1fcfff
commit 21b2ab7f12
2 changed files with 28 additions and 1 deletions

View file

@ -84,6 +84,8 @@ import net.minecraftforge.common.ForgeDirection;
import buildcraft.api.tools.IToolWrench;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dan200.computercraft.api.peripheral.IPeripheral;
import dan200.computercraft.api.peripheral.IPeripheralProvider;
/**
* Block class for handling multiple machine block IDs.
@ -117,7 +119,7 @@ import cpw.mods.fml.relauncher.SideOnly;
* @author AidanBrady
*
*/
public class BlockMachine extends BlockContainer implements ISpecialBounds
public class BlockMachine extends BlockContainer implements ISpecialBounds, IPeripheralProvider
{
public Icon[][] icons = new Icon[16][16];
public Random machineRand = new Random();
@ -1230,4 +1232,17 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
{
return false;
}
@Override
public IPeripheral getPeripheral(World world, int x, int y, int z, int side) {
TileEntity te = world.getBlockTileEntity(x, y, z);
if(te != null && te instanceof IPeripheral)
{
return (IPeripheral) te;
}
return null;
}
}

View file

@ -10,6 +10,7 @@ import java.util.List;
import java.util.Map;
import mekanism.common.Mekanism;
import mekanism.common.block.BlockMachine;
import mekanism.common.recipe.RecipeHandler;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.util.MekanismUtils;
@ -19,6 +20,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.event.FMLInterModComms;
import dan200.computercraft.api.ComputerCraftAPI;
/**
* Hooks for Mekanism. Use to grab items or blocks out of different mods.
@ -36,6 +38,7 @@ public final class MekanismHooks
public boolean BasicComponentsLoaded = false;
public boolean BuildCraftLoaded = false;
public boolean TELoaded = false;
public boolean CCLoaded = false;
public boolean MetallurgyCoreLoaded = false;
public boolean MetallurgyBaseLoaded = false;
@ -47,6 +50,7 @@ public final class MekanismHooks
if(Loader.isModLoaded("BasicComponents")) BasicComponentsLoaded = true;
if(Loader.isModLoaded("BuildCraft|Energy")) BuildCraftLoaded = true;
if(Loader.isModLoaded("ThermalExpansion")) TELoaded = true;
if(Loader.isModLoaded("ComputerCraft")) CCLoaded = true;
if(Loader.isModLoaded("Metallurgy3Core"))
{
@ -133,6 +137,14 @@ public final class MekanismHooks
{
System.out.println("[Mekanism] Hooked into BuildCraft successfully.");
}
if(CCLoaded)
{
try {
ComputerCraftAPI.registerPeripheralProvider((BlockMachine)Mekanism.MachineBlock);
} catch(Exception ex) {}
}
}
public void addPulverizerRecipe(ItemStack input, ItemStack output, int energy)