Fixed block names and implemented BC wrench API

This commit is contained in:
Brian Ricketts 2013-02-27 00:54:42 -06:00
parent 394becf356
commit 43cf672769
13 changed files with 309 additions and 244 deletions

View file

@ -22,6 +22,7 @@ import assemblyline.common.machine.encoder.ContainerEncoder;
import assemblyline.common.machine.encoder.TileEntityEncoder;
import assemblyline.common.machine.imprinter.ContainerImprinter;
import assemblyline.common.machine.imprinter.TileEntityImprinter;
import buildcraft.api.tools.IToolWrench;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.registry.GameRegistry;
@ -141,4 +142,13 @@ public class CommonProxy implements IGuiHandler
{
return false;
}
public static boolean isHoldingBCWrench(EntityPlayer player)
{
if (player.getCurrentEquippedItem() == null)
{
return false;
}
return player.getCurrentEquippedItem().getItem() instanceof IToolWrench;
}
}

View file

@ -0,0 +1,54 @@
package assemblyline.common.block;
import assemblyline.common.CommonProxy;
import universalelectricity.core.implement.IItemElectric;
import universalelectricity.prefab.BlockMachine;
import universalelectricity.prefab.implement.IToolConfigurator;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
public class BlockALMachine extends BlockMachine
{
public BlockALMachine(int id, Material material)
{
super(id, material);
}
public BlockALMachine(int id, int textureIndex, Material material)
{
super(id, textureIndex, material);
}
@Deprecated
public BlockALMachine(String string, int id, Material material)
{
this(id, material);
}
@Deprecated
public BlockALMachine(String string, int id, Material material, CreativeTabs creativeTab)
{
this(string, id, material);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
/**
* Check if the player is holding a wrench or an electric item. If so, do not open the GUI.
*/
if (player.inventory.getCurrentItem() != null)
{
if (CommonProxy.isHoldingBCWrench(player))
{
return this.onUseWrench(world, x, y, z, player, side, hitX, hitY, hitZ);
}
}
return super.onBlockActivated(world, x, y, z, player, side, hitX, hitY, hitZ);
}
}

View file

@ -12,7 +12,6 @@ import net.minecraft.world.World;
import universalelectricity.core.UniversalElectricity;
import universalelectricity.core.implement.IItemElectric;
import universalelectricity.core.vector.Vector3;
import universalelectricity.prefab.BlockMachine;
import universalelectricity.prefab.implement.IToolConfigurator;
import assemblyline.common.AssemblyLine;
import assemblyline.common.TabAssemblyLine;
@ -24,11 +23,12 @@ import assemblyline.common.TabAssemblyLine;
* @author Calclavia
*
*/
public class BlockCrate extends BlockMachine
public class BlockCrate extends BlockALMachine
{
public BlockCrate(int id, int texture)
{
super("crate", id, UniversalElectricity.machine);
super(id, UniversalElectricity.machine);
this.setBlockName("crate");
this.blockIndexInTexture = texture;
this.setCreativeTab(TabAssemblyLine.INSTANCE);
this.setTextureFile(AssemblyLine.BLOCK_TEXTURE_PATH);

View file

@ -11,12 +11,11 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.vector.Vector3;
import universalelectricity.prefab.BlockMachine;
import universalelectricity.prefab.implement.IRotatable;
import assemblyline.common.AssemblyLine;
import assemblyline.common.TabAssemblyLine;
public class BlockTurntable extends BlockMachine
public class BlockTurntable extends BlockALMachine
{
public BlockTurntable(int par1, int par2)
{

View file

@ -1,11 +1,11 @@
package assemblyline.common.machine;
import assemblyline.common.TabAssemblyLine;
import assemblyline.common.block.BlockALMachine;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import universalelectricity.prefab.BlockMachine;
public class BlockBeltSorter extends BlockMachine
public class BlockBeltSorter extends BlockALMachine
{
public BlockBeltSorter(int id)

View file

@ -9,18 +9,19 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import universalelectricity.core.UniversalElectricity;
import universalelectricity.core.vector.Vector3;
import universalelectricity.prefab.BlockMachine;
import universalelectricity.prefab.multiblock.IMultiBlock;
import assemblyline.client.render.BlockRenderingHandler;
import assemblyline.common.TabAssemblyLine;
import assemblyline.common.block.BlockALMachine;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockArmbot extends BlockMachine
public class BlockArmbot extends BlockALMachine
{
public BlockArmbot(int id)
{
super("armbot", id, UniversalElectricity.machine);
super(id, UniversalElectricity.machine);
this.setBlockName("armbot");
this.setCreativeTab(TabAssemblyLine.INSTANCE);
}

View file

@ -13,9 +13,9 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.UniversalElectricity;
import universalelectricity.prefab.BlockMachine;
import assemblyline.client.render.BlockRenderingHandler;
import assemblyline.common.TabAssemblyLine;
import assemblyline.common.block.BlockALMachine;
import assemblyline.common.machine.belt.TileEntityConveyorBelt.SlantType;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -25,11 +25,12 @@ import cpw.mods.fml.relauncher.SideOnly;
*
* @author Calclavia, DarkGuardsman
*/
public class BlockConveyorBelt extends BlockMachine
public class BlockConveyorBelt extends BlockALMachine
{
public BlockConveyorBelt(int id)
{
super("conveyorBelt", id, UniversalElectricity.machine);
super(id, UniversalElectricity.machine);
this.setBlockName("conveyorBelt");
this.setBlockBounds(0, 0, 0, 1, 0.3f, 1);
this.setCreativeTab(TabAssemblyLine.INSTANCE);
}

View file

@ -5,13 +5,13 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.UniversalElectricity;
import universalelectricity.prefab.BlockMachine;
import assemblyline.client.render.BlockRenderingHandler;
import assemblyline.common.TabAssemblyLine;
import assemblyline.common.block.BlockALMachine;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockCraneController extends BlockMachine
public class BlockCraneController extends BlockALMachine
{
public BlockCraneController(int id)
{

View file

@ -6,13 +6,13 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.UniversalElectricity;
import universalelectricity.prefab.BlockMachine;
import assemblyline.client.render.BlockRenderingHandler;
import assemblyline.common.TabAssemblyLine;
import assemblyline.common.block.BlockALMachine;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockCraneFrame extends BlockMachine
public class BlockCraneFrame extends BlockALMachine
{
public BlockCraneFrame(int id)
{

View file

@ -4,12 +4,12 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import universalelectricity.prefab.BlockMachine;
import assemblyline.common.AssemblyLine;
import assemblyline.common.CommonProxy;
import assemblyline.common.TabAssemblyLine;
import assemblyline.common.block.BlockALMachine;
public class BlockEncoder extends BlockMachine
public class BlockEncoder extends BlockALMachine
{
public BlockEncoder(int id, int texture)
{

View file

@ -9,16 +9,16 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import universalelectricity.prefab.BlockMachine;
import universalelectricity.prefab.implement.IRedstoneReceptor;
import assemblyline.api.IFilterable;
import assemblyline.common.block.BlockALMachine;
/**
* Extend this block class if a filter is allowed to be placed inside of this block.
*
* @author Calclavia
*/
public abstract class BlockImprintable extends BlockMachine
public abstract class BlockImprintable extends BlockALMachine
{
public BlockImprintable(String name, int id, Material material, CreativeTabs creativeTab)
{

View file

@ -9,12 +9,12 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import universalelectricity.prefab.BlockMachine;
import assemblyline.common.AssemblyLine;
import assemblyline.common.CommonProxy;
import assemblyline.common.TabAssemblyLine;
import assemblyline.common.block.BlockALMachine;
public class BlockImprinter extends BlockMachine
public class BlockImprinter extends BlockALMachine
{
public BlockImprinter(int id, int texture)
{