Created
November 9, 2012 19:54
-
-
Save magnifikus/4047835 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package de.squig.plc.blocks; | |
import java.util.Map; | |
import net.minecraft.src.Block; | |
import net.minecraft.src.BlockContainer; | |
import net.minecraft.src.CreativeTabs; | |
import net.minecraft.src.EntityPlayer; | |
import net.minecraft.src.IBlockAccess; | |
import net.minecraft.src.Material; | |
import net.minecraft.src.TileEntity; | |
import net.minecraft.src.World; | |
import net.minecraftforge.event.ForgeSubscribe; | |
import cpw.mods.fml.common.FMLCommonHandler; | |
import cpw.mods.fml.common.Side; | |
import de.squig.plc.PLC; | |
import de.squig.plc.lib.GuiIds; | |
import de.squig.plc.logic.helper.LogHelper; | |
import de.squig.plc.network.PacketControllerData; | |
import de.squig.plc.tile.TileController; | |
import de.squig.plc.tile.TileExtender; | |
public class ExtenderBasic extends BlockContainer { | |
public ExtenderBasic (int id) { | |
super(id, Material.rock); | |
setHardness(4.0F); // 33% harder than diamond | |
setStepSound(Block.soundStoneFootstep); | |
setBlockName("Basic Extender"); | |
setCreativeTab(CreativeTabs.tabBlock); | |
} | |
@Override | |
public String getTextureFile () { | |
return super.getTextureFile();//return CommonProxy.BLOCK_PNG; | |
} | |
@Override | |
public TileEntity createNewTileEntity(World var1) { | |
return new TileExtender(); | |
} | |
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { | |
Side side = FMLCommonHandler.instance().getEffectiveSide(); | |
if (side == Side.SERVER) { | |
TileExtender tileExtender = (TileExtender) world.getBlockTileEntity(x, y, z); | |
if (tileExtender != null) { | |
player.openGui(PLC.instance, GuiIds.EXTENDER, world, x, y, z); | |
//Circuit circuit = tileController.getCircuit(); | |
//PacketControllerData.sendElements(tileController, player, true); | |
} | |
} | |
return true; | |
} | |
public boolean canProvidePower() | |
{ | |
return true; | |
} | |
@Override | |
public void onNeighborBlockChange(World world, int i, int j, int k, int l) { | |
TileExtender tile = (TileExtender) world.getBlockTileEntity(i, j, k); | |
if (tile != null) { | |
tile.checkRedstonePower(); | |
} | |
} | |
/** | |
* Is this block powering the block on the specified side | |
*/ | |
public boolean isPoweringTo(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) | |
{ | |
if (true) | |
return true; | |
return (par1IBlockAccess.getBlockMetadata(par2, par3, par4) & 8) > 0; | |
} | |
/** | |
* Is this block indirectly powering the block on the specified side | |
*/ | |
public boolean isIndirectlyPoweringTo(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) | |
{ | |
if (true) | |
return true; | |
int var6 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); | |
if ((var6 & 8) == 0) | |
{ | |
return false; | |
} | |
else | |
{ | |
int var7 = var6 & 7; | |
return var7 == 0 && par5 == 0 ? true : (var7 == 7 && par5 == 0 ? true : (var7 == 6 && par5 == 1 ? true : (var7 == 5 && par5 == 1 ? true : (var7 == 4 && par5 == 2 ? true : (var7 == 3 && par5 == 3 ? true : (var7 == 2 && par5 == 4 ? true : var7 == 1 && par5 == 5)))))); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment