initial 1.8 port
This commit is contained in:
@@ -1,75 +1,37 @@
|
||||
package storagecraft.block;
|
||||
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import storagecraft.StorageCraft;
|
||||
import storagecraft.StorageCraftGUI;
|
||||
import storagecraft.tile.TileWirelessTransmitter;
|
||||
|
||||
public class BlockWirelessTransmitter extends BlockBase implements ITileEntityProvider
|
||||
{
|
||||
private IIcon icon;
|
||||
private IIcon workingIcon;
|
||||
private IIcon sideIcon;
|
||||
private IIcon workingSideIcon;
|
||||
|
||||
public BlockWirelessTransmitter()
|
||||
{
|
||||
super("wirelessTransmitter");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
player.openGui(StorageCraft.INSTANCE, StorageCraftGUI.WIRELESS_TRANSMITTER, world, x, y, z);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileWirelessTransmitter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
icon = register.registerIcon("storagecraft:wirelessTransmitter");
|
||||
workingIcon = register.registerIcon("storagecraft:wirelessTransmitterWorking");
|
||||
sideIcon = register.registerIcon("storagecraft:wirelessTransmitterSide");
|
||||
workingSideIcon = register.registerIcon("storagecraft:wirelessTransmitterSideWorking");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
TileWirelessTransmitter tile = (TileWirelessTransmitter) world.getTileEntity(x, y, z);
|
||||
|
||||
if (side == tile.getDirection().ordinal())
|
||||
{
|
||||
return tile.isWorking() ? workingIcon : icon;
|
||||
}
|
||||
|
||||
return tile.isWorking() ? workingSideIcon : sideIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int damage)
|
||||
{
|
||||
if (side == 3)
|
||||
{
|
||||
return icon;
|
||||
}
|
||||
|
||||
return sideIcon;
|
||||
}
|
||||
}
|
||||
package storagecraft.block;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import storagecraft.StorageCraft;
|
||||
import storagecraft.StorageCraftGUI;
|
||||
import storagecraft.tile.TileWirelessTransmitter;
|
||||
|
||||
// @TODO: This texture behaves differently
|
||||
public class BlockWirelessTransmitter extends BlockMachine
|
||||
{
|
||||
public BlockWirelessTransmitter()
|
||||
{
|
||||
super("wirelessTransmitter");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileWirelessTransmitter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
player.openGui(StorageCraft.INSTANCE, StorageCraftGUI.WIRELESS_TRANSMITTER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user