Fixed localization

This commit is contained in:
Francesco Macagno 2015-08-04 19:24:35 -07:00
parent ea146023f0
commit 8c54aea0de
27 changed files with 1007 additions and 979 deletions

View file

@ -24,6 +24,7 @@ public class BlockAir extends Block
public BlockAir() {
super(Material.air);
setHardness(0.0F);
setBlockName("warpdrive.blocks.Air");
}
@Override

View file

@ -27,6 +27,7 @@ public class BlockDecorative extends Block {
setHardness(0.5f);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
setBlockName("warpdrive.decorative.Plain");
}
public boolean isValidDamage(int damage) {

View file

@ -13,104 +13,105 @@ import net.minecraft.world.World;
import cr0s.warpdrive.WarpDriveConfig;
public class BlockGas extends Block {
private IIcon[] gasIcons;
private IIcon[] gasIcons;
public BlockGas() {
super(Material.air);
setHardness(0.0F);
}
public BlockGas() {
super(Material.air);
setHardness(0.0F);
setBlockName("warpdrive.blocks.Gas");
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean isAir(IBlockAccess var1, int var2, int var3, int var4) {
return true;
}
@Override
public boolean isAir(IBlockAccess var1, int var2, int var3, int var4) {
return true;
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
return null;
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
return null;
}
@Override
public boolean isReplaceable(IBlockAccess var1, int var2, int var3, int var4) {
return true;
}
@Override
public boolean isReplaceable(IBlockAccess var1, int var2, int var3, int var4) {
return true;
}
@Override
public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) {
return true;
}
@Override
public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) {
return true;
}
@Override
public boolean canCollideCheck(int var1, boolean var2) {
return false;
}
@Override
public boolean canCollideCheck(int var1, boolean var2) {
return false;
}
@Override
public int getRenderBlockPass() {
return 1; // transparency enabled
}
@Override
public int getRenderBlockPass() {
return 1; // transparency enabled
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
gasIcons = new IIcon[12];
gasIcons[0] = par1IconRegister.registerIcon("warpdrive:gasBlockBlue");
gasIcons[1] = par1IconRegister.registerIcon("warpdrive:gasBlockRed");
gasIcons[2] = par1IconRegister.registerIcon("warpdrive:gasBlockGreen");
gasIcons[3] = par1IconRegister.registerIcon("warpdrive:gasBlockYellow");
gasIcons[4] = par1IconRegister.registerIcon("warpdrive:gasBlockDark");
gasIcons[5] = par1IconRegister.registerIcon("warpdrive:gasBlockDarkness");
gasIcons[6] = par1IconRegister.registerIcon("warpdrive:gasBlockWhite");
gasIcons[7] = par1IconRegister.registerIcon("warpdrive:gasBlockMilk");
gasIcons[8] = par1IconRegister.registerIcon("warpdrive:gasBlockOrange");
gasIcons[9] = par1IconRegister.registerIcon("warpdrive:gasBlockSyren");
gasIcons[10] = par1IconRegister.registerIcon("warpdrive:gasBlockGray");
gasIcons[11] = par1IconRegister.registerIcon("warpdrive:gasBlockViolet");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
gasIcons = new IIcon[12];
gasIcons[0] = par1IconRegister.registerIcon("warpdrive:gasBlockBlue");
gasIcons[1] = par1IconRegister.registerIcon("warpdrive:gasBlockRed");
gasIcons[2] = par1IconRegister.registerIcon("warpdrive:gasBlockGreen");
gasIcons[3] = par1IconRegister.registerIcon("warpdrive:gasBlockYellow");
gasIcons[4] = par1IconRegister.registerIcon("warpdrive:gasBlockDark");
gasIcons[5] = par1IconRegister.registerIcon("warpdrive:gasBlockDarkness");
gasIcons[6] = par1IconRegister.registerIcon("warpdrive:gasBlockWhite");
gasIcons[7] = par1IconRegister.registerIcon("warpdrive:gasBlockMilk");
gasIcons[8] = par1IconRegister.registerIcon("warpdrive:gasBlockOrange");
gasIcons[9] = par1IconRegister.registerIcon("warpdrive:gasBlockSyren");
gasIcons[10] = par1IconRegister.registerIcon("warpdrive:gasBlockGray");
gasIcons[11] = par1IconRegister.registerIcon("warpdrive:gasBlockViolet");
}
@Override
public IIcon getIcon(int side, int metadata) {
return gasIcons[metadata % gasIcons.length]; // Lem
}
@Override
public IIcon getIcon(int side, int metadata) {
return gasIcons[metadata % gasIcons.length]; // Lem
}
@Override
public int getMobilityFlag() {
return 1;
}
@Override
public int getMobilityFlag() {
return 1;
}
@Override
public Item getItemDropped(int var1, Random var2, int var3) {
return null;
}
@Override
public int quantityDropped(Random par1Random) {
return 0;
}
@Override
public Item getItemDropped(int var1, Random var2, int var3) {
return null;
}
@Override
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
Block sideBlock = world.getBlock(x, y, z);
if (sideBlock.isAssociatedBlock(this)) {
return false;
}
return world.isAirBlock(x, y, z);
}
@Override
public boolean isCollidable() {
return false;
}
@Override
public int quantityDropped(Random par1Random) {
return 0;
}
@Override
public void onBlockAdded(World par1World, int par2, int par3, int par4) {
// Gas blocks allow only in space
if (par1World.provider.dimensionId != WarpDriveConfig.G_SPACE_DIMENSION_ID) {
par1World.setBlockToAir(par2, par3, par4);
}
}
@Override
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
Block sideBlock = world.getBlock(x, y, z);
if (sideBlock.isAssociatedBlock(this)) {
return false;
}
return world.isAirBlock(x, y, z);
}
@Override
public boolean isCollidable() {
return false;
}
@Override
public void onBlockAdded(World par1World, int par2, int par3, int par4) {
// Gas blocks allow only in space
if (par1World.provider.dimensionId != WarpDriveConfig.G_SPACE_DIMENSION_ID) {
par1World.setBlockToAir(par2, par3, par4);
}
}
}

View file

@ -10,30 +10,31 @@ import cr0s.warpdrive.WarpDrive;
public class BlockIridium extends Block
{
public BlockIridium()
{
super(Material.rock);
setHardness(0.8F);
public BlockIridium()
{
super(Material.rock);
setHardness(0.8F);
setResistance(150 * 4);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
}
setBlockName("warpdrive.blocks.IridiumBlock");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister)
{
this.blockIcon = par1IconRegister.registerIcon("warpdrive:iridiumSide");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister)
{
this.blockIcon = par1IconRegister.registerIcon("warpdrive:iridiumSide");
}
@Override
public Item getItemDropped(int var1, Random var2, int var3)
{
return Item.getItemFromBlock(this);
}
@Override
public Item getItemDropped(int var1, Random var2, int var3)
{
return Item.getItemFromBlock(this);
}
@Override
public int quantityDropped(Random par1Random)
{
return 1;
}
@Override
public int quantityDropped(Random par1Random)
{
return 1;
}
}

View file

@ -15,6 +15,7 @@ public class BlockTransportBeacon extends Block {
setHardness(0.5F);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
setBlockName("warpdrive.blocks.TransportBeacon");
}
@Override

View file

@ -21,100 +21,101 @@ import cr0s.warpdrive.api.IAirCanister;
public class BlockAirGenerator extends BlockContainer
{
private IIcon[] iconBuffer;
private IIcon[] iconBuffer;
private final int ICON_INACTIVE_SIDE = 0, ICON_BOTTOM = 1, ICON_SIDE_ACTIVATED = 2;
private final int ICON_INACTIVE_SIDE = 0, ICON_BOTTOM = 1, ICON_SIDE_ACTIVATED = 2;
public BlockAirGenerator(int texture, Material material)
{
super(material);
setHardness(0.5F);
public BlockAirGenerator(int texture, Material material)
{
super(material);
setHardness(0.5F);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
}
setBlockName("warpdrive.machines.AirGenerator");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister)
{
iconBuffer = new IIcon[3];
iconBuffer[ICON_INACTIVE_SIDE] = par1IconRegister.registerIcon("warpdrive:airgenSideInactive");
iconBuffer[ICON_BOTTOM] = par1IconRegister.registerIcon("warpdrive:contBottom");
iconBuffer[ICON_SIDE_ACTIVATED] = par1IconRegister.registerIcon("warpdrive:airgenSideActive");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister)
{
iconBuffer = new IIcon[3];
iconBuffer[ICON_INACTIVE_SIDE] = par1IconRegister.registerIcon("warpdrive:airgenSideInactive");
iconBuffer[ICON_BOTTOM] = par1IconRegister.registerIcon("warpdrive:contBottom");
iconBuffer[ICON_SIDE_ACTIVATED] = par1IconRegister.registerIcon("warpdrive:airgenSideActive");
}
@Override
public IIcon getIcon(int side, int metadata) {
if (side == 0) {
return iconBuffer[ICON_BOTTOM];
} else if (side == 1) {
if (metadata == 0) {
return iconBuffer[ICON_INACTIVE_SIDE];
} else {
return iconBuffer[ICON_SIDE_ACTIVATED];
}
}
@Override
public IIcon getIcon(int side, int metadata) {
if (side == 0) {
return iconBuffer[ICON_BOTTOM];
} else if (side == 1) {
if (metadata == 0) {
return iconBuffer[ICON_INACTIVE_SIDE];
} else {
return iconBuffer[ICON_SIDE_ACTIVATED];
}
}
if (metadata == 0) { // Inactive state
return iconBuffer[ICON_INACTIVE_SIDE];
} else if (metadata == 1) {
return iconBuffer[ICON_SIDE_ACTIVATED];
}
if (metadata == 0) { // Inactive state
return iconBuffer[ICON_INACTIVE_SIDE];
} else if (metadata == 1) {
return iconBuffer[ICON_SIDE_ACTIVATED];
}
return null;
}
return null;
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityAirGenerator();
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityAirGenerator();
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer player, int par6, float par7, float par8, float par9) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return false;
}
WarpEnergyTE te = (WarpEnergyTE)par1World.getTileEntity(par2, par3, par4);
if (te != null) {
ItemStack heldItemStack = player.getHeldItem();
if (heldItemStack == null) {
player.addChatMessage(new ChatComponentText(te.getStatus()));
return true;
} else {
Item heldItem = heldItemStack.getItem();
if (heldItem != null && (heldItem instanceof IAirCanister)) {
IAirCanister airCanister = (IAirCanister)heldItem;
if (airCanister.canContainAir(heldItemStack) && te.consumeEnergy(WarpDriveConfig.AG_RF_PER_CANISTER, true)) {
player.inventory.decrStackSize(player.inventory.currentItem, 1);
ItemStack toAdd = airCanister.fullDrop(heldItemStack);
if (toAdd != null) {
if (!player.inventory.addItemStackToInventory(toAdd)) {
EntityItem ie = new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, toAdd);
player.worldObj.spawnEntityInWorld(ie);
}
te.consumeEnergy(WarpDriveConfig.AG_RF_PER_CANISTER, false);
}
}
}
}
}
return false;
}
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer player, int par6, float par7, float par8, float par9) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return false;
}
WarpEnergyTE te = (WarpEnergyTE)par1World.getTileEntity(par2, par3, par4);
if (te != null) {
ItemStack heldItemStack = player.getHeldItem();
if (heldItemStack == null) {
player.addChatMessage(new ChatComponentText(te.getStatus()));
return true;
} else {
Item heldItem = heldItemStack.getItem();
if (heldItem != null && (heldItem instanceof IAirCanister)) {
IAirCanister airCanister = (IAirCanister)heldItem;
if (airCanister.canContainAir(heldItemStack) && te.consumeEnergy(WarpDriveConfig.AG_RF_PER_CANISTER, true)) {
player.inventory.decrStackSize(player.inventory.currentItem, 1);
ItemStack toAdd = airCanister.fullDrop(heldItemStack);
if (toAdd != null) {
if (!player.inventory.addItemStackToInventory(toAdd)) {
EntityItem ie = new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, toAdd);
player.worldObj.spawnEntityInWorld(ie);
}
te.consumeEnergy(WarpDriveConfig.AG_RF_PER_CANISTER, false);
}
}
}
}
}
return false;
}
}

View file

@ -17,74 +17,76 @@ import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.data.CamRegistryItem;
public class BlockCamera extends BlockContainer {
private IIcon[] iconBuffer;
private IIcon[] iconBuffer;
private final int ICON_SIDE = 0;
private final int ICON_SIDE = 0;
public BlockCamera(int texture, Material material) {
super(material);
setHardness(0.5F);
public BlockCamera(int texture, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
}
this.setBlockName("warpdrive.machines.CloakingCoil");
this.setBlockName("warpdrive.machines.Camera");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[1];
// Solid textures
iconBuffer[ICON_SIDE] = par1IconRegister.registerIcon("warpdrive:cameraSide");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[1];
// Solid textures
iconBuffer[ICON_SIDE] = par1IconRegister.registerIcon("warpdrive:cameraSide");
}
@Override
public IIcon getIcon(int side, int metadata) {
return iconBuffer[ICON_SIDE];
}
@Override
public IIcon getIcon(int side, int metadata) {
return iconBuffer[ICON_SIDE];
}
@Override
public TileEntity createNewTileEntity(World parWorld, int i) {
return new TileEntityCamera();
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
@Override
public TileEntity createNewTileEntity(World parWorld, int i) {
return new TileEntityCamera();
}
/**
* Called upon block activation (right click on the block.)
*/
@Override
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
* Called upon block activation (right click on the block.)
*/
@Override
public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return false;
}
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return false;
}
// Get camera frequency
TileEntity te = par1World.getTileEntity(x, y, z);
if (te != null && te instanceof TileEntityCamera && (par5EntityPlayer.getHeldItem() == null)) {
int frequency = ((TileEntityCamera)te).getFrequency();
// Get camera frequency
TileEntity te = par1World.getTileEntity(x, y, z);
if (te != null && te instanceof TileEntityCamera && (par5EntityPlayer.getHeldItem() == null)) {
int frequency = ((TileEntityCamera)te).getFrequency();
CamRegistryItem cam = WarpDrive.instance.cams.getCamByFrequency(par1World, frequency);
if (cam == null) {
WarpDrive.instance.cams.printRegistry(par1World);
par5EntityPlayer.addChatMessage(new ChatComponentText(getLocalizedName() + " Frequency '" + frequency + "' is invalid!"));
} else {
par5EntityPlayer.addChatMessage(new ChatComponentText(getLocalizedName() + " Frequency '" + frequency + "' is valid for camera at " + cam.position.chunkPosX + ", " + cam.position.chunkPosY + ", " + cam.position.chunkPosZ));
}
return true;
}
CamRegistryItem cam = WarpDrive.instance.cams.getCamByFrequency(par1World, frequency);
if (cam == null) {
WarpDrive.instance.cams.printRegistry(par1World);
par5EntityPlayer.addChatMessage(new ChatComponentText(getLocalizedName() + " Frequency '" + frequency + "' is invalid!"));
} else {
par5EntityPlayer.addChatMessage(new ChatComponentText(getLocalizedName() + " Frequency '" + frequency + "' is valid for camera at " + cam.position.chunkPosX + ", " + cam.position.chunkPosY + ", " + cam.position.chunkPosZ));
}
return true;
}
return false;
}
return false;
}
}

View file

@ -10,52 +10,53 @@ import net.minecraft.util.IIcon;
import cr0s.warpdrive.WarpDrive;
public class BlockCloakingCoil extends Block {
private IIcon[] iconBuffer;
private IIcon[] iconBuffer;
public BlockCloakingCoil(int texture, Material material) {
super(material);
setHardness(0.5F);
public BlockCloakingCoil(int texture, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
}
this.setBlockName("warpdrive.machines.CloakingCoil");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[3];
iconBuffer[0] = par1IconRegister.registerIcon("warpdrive:cloakCoilSide");
iconBuffer[1] = par1IconRegister.registerIcon("warpdrive:cloakCoilSideActive");
iconBuffer[2] = par1IconRegister.registerIcon("warpdrive:cloakCoilTop");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[3];
iconBuffer[0] = par1IconRegister.registerIcon("warpdrive:cloakCoilSide");
iconBuffer[1] = par1IconRegister.registerIcon("warpdrive:cloakCoilSideActive");
iconBuffer[2] = par1IconRegister.registerIcon("warpdrive:cloakCoilTop");
}
@Override
public IIcon getIcon(int side, int metadata) {
if (side == 0) {
return iconBuffer[2];
} else if (side == 1) {
return iconBuffer[2];
}
if (metadata == 0) {
return iconBuffer[0];
} else if (metadata == 1) {
return iconBuffer[1];
} else {
return null;
}
}
@Override
public IIcon getIcon(int side, int metadata) {
if (side == 0) {
return iconBuffer[2];
} else if (side == 1) {
return iconBuffer[2];
}
if (metadata == 0) {
return iconBuffer[0];
} else if (metadata == 1) {
return iconBuffer[1];
} else {
return null;
}
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
}

View file

@ -16,80 +16,81 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cr0s.warpdrive.WarpDrive;
public class BlockCloakingDeviceCore extends BlockContainer {
private IIcon[] iconBuffer;
private IIcon[] iconBuffer;
public BlockCloakingDeviceCore(int texture, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
}
public BlockCloakingDeviceCore(int texture, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
this.setBlockName("warpdrive.machines.CloakingDeviceCore");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[2];
iconBuffer[0] = par1IconRegister.registerIcon("warpdrive:cloakingCoreInactive");
iconBuffer[1] = par1IconRegister.registerIcon("warpdrive:cloakingCoreActive");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[2];
iconBuffer[0] = par1IconRegister.registerIcon("warpdrive:cloakingCoreInactive");
iconBuffer[1] = par1IconRegister.registerIcon("warpdrive:cloakingCoreActive");
}
@Override
public IIcon getIcon(int side, int metadata) {
if (metadata < iconBuffer.length) {
return iconBuffer[metadata];
} else {
return null;
}
}
@Override
public IIcon getIcon(int side, int metadata) {
if (metadata < iconBuffer.length) {
return iconBuffer[metadata];
} else {
return null;
}
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityCloakingDeviceCore();
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityCloakingDeviceCore();
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return false;
}
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return false;
}
TileEntityCloakingDeviceCore te = (TileEntityCloakingDeviceCore)par1World.getTileEntity(par2, par3, par4);
if (te != null && (par5EntityPlayer.getHeldItem() == null)) {
par5EntityPlayer.addChatMessage(new ChatComponentText(te.getStatus() + "\n"
// + " Valid? " + te.isValid + " Cloaking? " + te.isCloaking + " Enabled? " + te.isEnabled + "\n"
+ ((!te.isValid) ? "Invalid assembly!" :
((!te.isEnabled) ? "Cloak is disabled" :
((te.isCloaking) ? "A tier " + te.tier + " cloak is currently covering " + te.volume + " blocks!" : "Cloak needs more power!")))));
return true;
}
TileEntityCloakingDeviceCore te = (TileEntityCloakingDeviceCore)par1World.getTileEntity(par2, par3, par4);
if (te != null && (par5EntityPlayer.getHeldItem() == null)) {
par5EntityPlayer.addChatMessage(new ChatComponentText(te.getStatus() + "\n"
// + " Valid? " + te.isValid + " Cloaking? " + te.isCloaking + " Enabled? " + te.isEnabled + "\n"
+ ((!te.isValid) ? "Invalid assembly!" :
((!te.isEnabled) ? "Cloak is disabled" :
((te.isCloaking) ? "A tier " + te.tier + " cloak is currently covering " + te.volume + " blocks!" : "Cloak needs more power!")))));
return true;
}
return false;
}
return false;
}
@Override
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
TileEntity te = par1World.getTileEntity(par2, par3, par4);
@Override
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
TileEntity te = par1World.getTileEntity(par2, par3, par4);
if (te != null && te instanceof TileEntityCloakingDeviceCore) {
((TileEntityCloakingDeviceCore)te).isEnabled = false;
((TileEntityCloakingDeviceCore)te).disableCloakingField();
}
if (te != null && te instanceof TileEntityCloakingDeviceCore) {
((TileEntityCloakingDeviceCore)te).isEnabled = false;
((TileEntityCloakingDeviceCore)te).disableCloakingField();
}
super.breakBlock(par1World, par2, par3, par4, par5, par6);
}
super.breakBlock(par1World, par2, par3, par4, par5, par6);
}
}

View file

@ -13,47 +13,48 @@ import net.minecraft.world.World;
import cr0s.warpdrive.WarpDrive;
public class BlockLaser extends BlockContainer {
private IIcon[] iconBuffer;
private IIcon[] iconBuffer;
private final int ICON_SIDE = 0;
private final int ICON_SIDE = 0;
public BlockLaser(int texture, Material material) {
super(material);
setHardness(0.5F);
public BlockLaser(int texture, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
}
this.setBlockName("warpdrive.machines.Laser");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[1];
// Solid textures
iconBuffer[ICON_SIDE] = par1IconRegister.registerIcon("warpdrive:laserSide");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[1];
// Solid textures
iconBuffer[ICON_SIDE] = par1IconRegister.registerIcon("warpdrive:laserSide");
}
@Override
public IIcon getIcon(int side, int metadata) {
return iconBuffer[ICON_SIDE];
}
@Override
public IIcon getIcon(int side, int metadata) {
return iconBuffer[ICON_SIDE];
}
@Override
public TileEntity createNewTileEntity(World parWorld, int i) {
return new TileEntityLaser();
}
@Override
public TileEntity createNewTileEntity(World parWorld, int i) {
return new TileEntityLaser();
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
}

View file

@ -17,73 +17,74 @@ import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.data.CamRegistryItem;
public class BlockLaserCam extends BlockContainer {
private IIcon[] iconBuffer;
private IIcon[] iconBuffer;
private final int ICON_SIDE = 0;
private final int ICON_SIDE = 0;
public BlockLaserCam(int texture, Material material) {
super(material);
setHardness(0.5F);
public BlockLaserCam(int texture, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
}
this.setBlockName("warpdrive.machines.LaserCamera");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[1];
// Solid textures
iconBuffer[ICON_SIDE] = par1IconRegister.registerIcon("warpdrive:laserSideCam");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[1];
// Solid textures
iconBuffer[ICON_SIDE] = par1IconRegister.registerIcon("warpdrive:laserSideCam");
}
@Override
public IIcon getIcon(int side, int metadata) {
return iconBuffer[ICON_SIDE];
}
@Override
public IIcon getIcon(int side, int metadata) {
return iconBuffer[ICON_SIDE];
}
@Override
public TileEntity createNewTileEntity(World parWorld, int i) {
return new TileEntityLaser();
}
@Override
public TileEntity createNewTileEntity(World parWorld, int i) {
return new TileEntityLaser();
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
* Called upon block activation (right click on the block.)
*/
@Override
/**
* Called upon block activation (right click on the block.)
*/
@Override
public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return false;
}
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return false;
}
// Get camera frequency
TileEntity te = par1World.getTileEntity(x, y, z);
if (!WarpDrive.instance.isOverlayEnabled && te != null && te instanceof TileEntityLaser && (par5EntityPlayer.getHeldItem() == null)) {
int beamFrequency = ((TileEntityLaser)te).getBeamFrequency();
int cameraFrequency = ((TileEntityLaser)te).getCameraFrequency();
// Get camera frequency
TileEntity te = par1World.getTileEntity(x, y, z);
if (!WarpDrive.instance.isOverlayEnabled && te != null && te instanceof TileEntityLaser && (par5EntityPlayer.getHeldItem() == null)) {
int beamFrequency = ((TileEntityLaser)te).getBeamFrequency();
int cameraFrequency = ((TileEntityLaser)te).getCameraFrequency();
CamRegistryItem cam = WarpDrive.instance.cams.getCamByFrequency(par1World, cameraFrequency);
WarpDrive.debugPrint("cam detected as " + cam);
par5EntityPlayer.addChatMessage(new ChatComponentText(getLocalizedName()
+ ": Beam frequency '" + beamFrequency + "' is " + ((beamFrequency < 0) ? "invalid!" : "valid.")
+ " Camera frequency '" + cameraFrequency + "' is " + ((cam == null) ? "invalid!" : "valid for laser-camera at " + cam.position.chunkPosX + ", " + cam.position.chunkPosY + ", " + cam.position.chunkPosZ)));
return true;
}
CamRegistryItem cam = WarpDrive.instance.cams.getCamByFrequency(par1World, cameraFrequency);
WarpDrive.debugPrint("cam detected as " + cam);
par5EntityPlayer.addChatMessage(new ChatComponentText(getLocalizedName()
+ ": Beam frequency '" + beamFrequency + "' is " + ((beamFrequency < 0) ? "invalid!" : "valid.")
+ " Camera frequency '" + cameraFrequency + "' is " + ((cam == null) ? "invalid!" : "valid for laser-camera at " + cam.position.chunkPosX + ", " + cam.position.chunkPosY + ", " + cam.position.chunkPosZ)));
return true;
}
return false;
}
return false;
}
}

View file

@ -14,6 +14,7 @@ public class BlockLaserReactorMonitor extends BlockContainer {
setHardness(0.5F);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
this.setBlockName("warpdrive.machines.LaserReactorMonitor");
}
public BlockLaserReactorMonitor(Material material) {

View file

@ -20,6 +20,7 @@ public class BlockLaserTreeFarm extends BlockContainer {
setHardness(0.5F);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
this.setBlockName("warpdrive.machines.LaserTreeFarm");
}
@Override

View file

@ -17,80 +17,81 @@ import cr0s.warpdrive.WarpDrive;
public class BlockLift extends BlockContainer
{
private IIcon[] iconBuffer;
private IIcon[] iconBuffer;
public BlockLift(int texture, Material material) {
super(material);
setHardness(0.5F);
public BlockLift(int texture, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
}
this.setBlockName("warpdrive.machines.LaserLift");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[6];
iconBuffer[0] = par1IconRegister.registerIcon("warpdrive:liftSideOffline");
iconBuffer[1] = par1IconRegister.registerIcon("warpdrive:liftSideUp");
iconBuffer[2] = par1IconRegister.registerIcon("warpdrive:liftSideDown");
iconBuffer[3] = par1IconRegister.registerIcon("warpdrive:liftUpInactive");
iconBuffer[4] = par1IconRegister.registerIcon("warpdrive:liftUpOut");
iconBuffer[5] = par1IconRegister.registerIcon("warpdrive:liftUpIn");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[6];
iconBuffer[0] = par1IconRegister.registerIcon("warpdrive:liftSideOffline");
iconBuffer[1] = par1IconRegister.registerIcon("warpdrive:liftSideUp");
iconBuffer[2] = par1IconRegister.registerIcon("warpdrive:liftSideDown");
iconBuffer[3] = par1IconRegister.registerIcon("warpdrive:liftUpInactive");
iconBuffer[4] = par1IconRegister.registerIcon("warpdrive:liftUpOut");
iconBuffer[5] = par1IconRegister.registerIcon("warpdrive:liftUpIn");
}
@Override
public IIcon getIcon(int side, int metadata) {
if (metadata > 2) {
return iconBuffer[0];
}
if (side == 1) {
return iconBuffer[3 + metadata];
} else if (side == 0) {
if (metadata == 0) {
return iconBuffer[3];
} else {
return iconBuffer[6 - metadata];
}
}
@Override
public IIcon getIcon(int side, int metadata) {
if (metadata > 2) {
return iconBuffer[0];
}
if (side == 1) {
return iconBuffer[3 + metadata];
} else if (side == 0) {
if (metadata == 0) {
return iconBuffer[3];
} else {
return iconBuffer[6 - metadata];
}
}
return iconBuffer[metadata];
}
return iconBuffer[metadata];
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityLift();
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityLift();
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
* Called upon block activation (right click on the block.)
*/
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return false;
}
/**
* Called upon block activation (right click on the block.)
*/
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return false;
}
WarpEnergyTE te = (WarpEnergyTE)par1World.getTileEntity(par2, par3, par4);
if (te != null && (par5EntityPlayer.getHeldItem() == null)) {
par5EntityPlayer.addChatMessage(new ChatComponentText(te.getStatus()));
return true;
}
WarpEnergyTE te = (WarpEnergyTE)par1World.getTileEntity(par2, par3, par4);
if (te != null && (par5EntityPlayer.getHeldItem() == null)) {
par5EntityPlayer.addChatMessage(new ChatComponentText(te.getStatus()));
return true;
}
return false;
}
return false;
}
}

View file

@ -16,82 +16,83 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cr0s.warpdrive.WarpDrive;
public class BlockMiningLaser extends BlockContainer {
private IIcon[] iconBuffer;
private final static int ICON_TOP = 5;
public final static int ICON_IDLE = 0;
public final static int ICON_MININGLOWPOWER = 1;
public final static int ICON_MININGPOWERED = 2;
public final static int ICON_SCANNINGLOWPOWER = 3;
public final static int ICON_SCANNINGPOWERED = 4;
private IIcon[] iconBuffer;
private final static int ICON_TOP = 5;
public final static int ICON_IDLE = 0;
public final static int ICON_MININGLOWPOWER = 1;
public final static int ICON_MININGPOWERED = 2;
public final static int ICON_SCANNINGLOWPOWER = 3;
public final static int ICON_SCANNINGPOWERED = 4;
public BlockMiningLaser(int texture, Material material) {
super(material);
setHardness(0.5F);
public BlockMiningLaser(int texture, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
}
this.setBlockName("warpdrive.machines.MiningLaser");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[16];
// Solid textures
iconBuffer[ICON_TOP ] = par1IconRegister.registerIcon("warpdrive:particleBoosterTopBottom");
iconBuffer[ICON_IDLE ] = par1IconRegister.registerIcon("warpdrive:miningLaser_idle");
iconBuffer[ICON_MININGLOWPOWER ] = par1IconRegister.registerIcon("warpdrive:miningLaser_miningLowPower");
iconBuffer[ICON_MININGPOWERED ] = par1IconRegister.registerIcon("warpdrive:miningLaser_miningPowered");
iconBuffer[ICON_SCANNINGLOWPOWER] = par1IconRegister.registerIcon("warpdrive:miningLaser_scanningLowPower");
iconBuffer[ICON_SCANNINGPOWERED ] = par1IconRegister.registerIcon("warpdrive:miningLaser_scanningPowered");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[16];
// Solid textures
iconBuffer[ICON_TOP ] = par1IconRegister.registerIcon("warpdrive:particleBoosterTopBottom");
iconBuffer[ICON_IDLE ] = par1IconRegister.registerIcon("warpdrive:miningLaser_idle");
iconBuffer[ICON_MININGLOWPOWER ] = par1IconRegister.registerIcon("warpdrive:miningLaser_miningLowPower");
iconBuffer[ICON_MININGPOWERED ] = par1IconRegister.registerIcon("warpdrive:miningLaser_miningPowered");
iconBuffer[ICON_SCANNINGLOWPOWER] = par1IconRegister.registerIcon("warpdrive:miningLaser_scanningLowPower");
iconBuffer[ICON_SCANNINGPOWERED ] = par1IconRegister.registerIcon("warpdrive:miningLaser_scanningPowered");
}
@Override
public IIcon getIcon(int side, int metadata) {
if (side == 0 || side == 1) {
return iconBuffer[ICON_TOP];
}
if (metadata < iconBuffer.length) {
return iconBuffer[metadata];
} else {
return null;
}
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityMiningLaser();
}
@Override
public IIcon getIcon(int side, int metadata) {
if (side == 0 || side == 1) {
return iconBuffer[ICON_TOP];
}
if (metadata < iconBuffer.length) {
return iconBuffer[metadata];
} else {
return null;
}
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityMiningLaser();
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Called upon block activation (right click on the block.)
*/
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return false;
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
TileEntityMiningLaser miningLaser = (TileEntityMiningLaser)par1World.getTileEntity(par2, par3, par4);
/**
* Called upon block activation (right click on the block.)
*/
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return false;
}
if (miningLaser != null && (par5EntityPlayer.getHeldItem() == null)) {
par5EntityPlayer.addChatMessage(new ChatComponentText(miningLaser.getStatus()));
return true;
}
TileEntityMiningLaser miningLaser = (TileEntityMiningLaser)par1World.getTileEntity(par2, par3, par4);
return false;
}
if (miningLaser != null && (par5EntityPlayer.getHeldItem() == null)) {
par5EntityPlayer.addChatMessage(new ChatComponentText(miningLaser.getStatus()));
return true;
}
return false;
}
}

View file

@ -18,81 +18,82 @@ import cr0s.warpdrive.render.ClientCameraUtils;
import cr0s.warpdrive.render.EntityCamera;
public class BlockMonitor extends BlockContainer {
private IIcon iconFront;
private IIcon iconBlock;
private IIcon iconFront;
private IIcon iconBlock;
public BlockMonitor() {
super(Material.iron);
setHardness(0.5F);
public BlockMonitor() {
super(Material.iron);
setHardness(0.5F);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
}
setBlockName("warpdrive.machines.Monitor");
}
@Override
@Override
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
public IIcon getIcon(int side, int parMetadata) {
int meta = parMetadata & 3;
return side == 2 ? (meta == 0 ? this.iconFront : this.iconBlock) : (side == 3 ? (meta == 2 ? this.iconFront : this.iconBlock) : (side == 4 ? (meta == 3 ? this.iconFront : this.iconBlock) : (side == 5 ? (meta == 1 ? this.iconFront : this.iconBlock) : this.iconBlock)));
}
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
public IIcon getIcon(int side, int parMetadata) {
int meta = parMetadata & 3;
return side == 2 ? (meta == 0 ? this.iconFront : this.iconBlock) : (side == 3 ? (meta == 2 ? this.iconFront : this.iconBlock) : (side == 4 ? (meta == 3 ? this.iconFront : this.iconBlock) : (side == 5 ? (meta == 1 ? this.iconFront : this.iconBlock) : this.iconBlock)));
}
/**
* When this method is called, your block should register all the icons it needs with the given IconRegister. This
* is the only chance you get to register icons.
*/
@Override
/**
* When this method is called, your block should register all the icons it needs with the given IconRegister. This
* is the only chance you get to register icons.
*/
@Override
public void registerBlockIcons(IIconRegister reg) {
this.iconFront = reg.registerIcon("warpdrive:monitorFront");
this.iconBlock = reg.registerIcon("warpdrive:monitorSide");
}
this.iconFront = reg.registerIcon("warpdrive:monitorFront");
this.iconBlock = reg.registerIcon("warpdrive:monitorSide");
}
/**
* Called when the block is placed in the world.
*/
@Override
/**
* Called when the block is placed in the world.
*/
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack itemstack) {
int dir = Math.round(entityliving.rotationYaw / 90.0F) & 3;
world.setBlockMetadataWithNotify(x, y, z, dir, 3);
}
int dir = Math.round(entityliving.rotationYaw / 90.0F) & 3;
world.setBlockMetadataWithNotify(x, y, z, dir, 3);
}
/**
* Called upon block activation (right click on the block.)
*/
@Override
/**
* Called upon block activation (right click on the block.)
*/
@Override
public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
// Monitor is only reacting client side
if (!FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return false;
}
// Monitor is only reacting client side
if (!FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return false;
}
// Get camera frequency
TileEntity te = par1World.getTileEntity(x, y, z);
// Get camera frequency
TileEntity te = par1World.getTileEntity(x, y, z);
if (te != null && te instanceof TileEntityMonitor && (par5EntityPlayer.getHeldItem() == null)) {
int frequency = ((TileEntityMonitor)te).getFrequency();
CamRegistryItem cam = WarpDrive.instance.cams.getCamByFrequency(par1World, frequency);
if (cam == null) {
par5EntityPlayer.addChatMessage(new ChatComponentText(getLocalizedName() + " Frequency '" + frequency + "' is invalid or camera is too far!"));
return false;
} else {
par5EntityPlayer.addChatMessage(new ChatComponentText(getLocalizedName() + " Frequency '" + frequency + "' is valid. Viewing camera at " + cam.position.chunkPosX + ", " + cam.position.chunkPosY + ", " + cam.position.chunkPosZ));
// Spawn camera entity
EntityCamera e = new EntityCamera(par1World, cam.position, par5EntityPlayer);
par1World.spawnEntityInWorld(e);
e.setPositionAndUpdate(cam.position.chunkPosX + 0.5D, cam.position.chunkPosY + 0.5D, cam.position.chunkPosZ + 0.5D);
//e.setPositionAndRotation(camPos.x, camPos.y, camPos.z, entityplayer.rotationYaw, entityplayer.rotationPitch);
WarpDrive.instance.overlayType = cam.type;
ClientCameraUtils.setupViewpoint(par5EntityPlayer, e, x, y, z, this, cam.position.chunkPosX, cam.position.chunkPosY, cam.position.chunkPosZ, par1World.getBlock(cam.position.chunkPosX, cam.position.chunkPosY, cam.position.chunkPosZ));
}
}
if (te != null && te instanceof TileEntityMonitor && (par5EntityPlayer.getHeldItem() == null)) {
int frequency = ((TileEntityMonitor)te).getFrequency();
CamRegistryItem cam = WarpDrive.instance.cams.getCamByFrequency(par1World, frequency);
if (cam == null) {
par5EntityPlayer.addChatMessage(new ChatComponentText(getLocalizedName() + " Frequency '" + frequency + "' is invalid or camera is too far!"));
return false;
} else {
par5EntityPlayer.addChatMessage(new ChatComponentText(getLocalizedName() + " Frequency '" + frequency + "' is valid. Viewing camera at " + cam.position.chunkPosX + ", " + cam.position.chunkPosY + ", " + cam.position.chunkPosZ));
// Spawn camera entity
EntityCamera e = new EntityCamera(par1World, cam.position, par5EntityPlayer);
par1World.spawnEntityInWorld(e);
e.setPositionAndUpdate(cam.position.chunkPosX + 0.5D, cam.position.chunkPosY + 0.5D, cam.position.chunkPosZ + 0.5D);
//e.setPositionAndRotation(camPos.x, camPos.y, camPos.z, entityplayer.rotationYaw, entityplayer.rotationPitch);
WarpDrive.instance.overlayType = cam.type;
ClientCameraUtils.setupViewpoint(par5EntityPlayer, e, x, y, z, this, cam.position.chunkPosX, cam.position.chunkPosY, cam.position.chunkPosZ, par1World.getBlock(cam.position.chunkPosX, cam.position.chunkPosY, cam.position.chunkPosZ));
}
}
return false;
}
return false;
}
@Override
public TileEntity createNewTileEntity(World world, int i) {
return new TileEntityMonitor();
}
@Override
public TileEntity createNewTileEntity(World world, int i) {
return new TileEntityMonitor();
}
}

View file

@ -16,71 +16,72 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cr0s.warpdrive.WarpDrive;
public class BlockParticleBooster extends BlockContainer {
private IIcon[] iconBuffer;
private IIcon[] iconBuffer;
public BlockParticleBooster(int texture, Material material) {
super(material);
setHardness(0.5F);
public BlockParticleBooster(int texture, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
}
setBlockName("warpdrive.machines.ParticleBooster");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[16];
iconBuffer[ 0] = par1IconRegister.registerIcon("warpdrive:particleBoosterSide0");
iconBuffer[ 1] = par1IconRegister.registerIcon("warpdrive:particleBoosterSide1");
iconBuffer[ 2] = par1IconRegister.registerIcon("warpdrive:particleBoosterSide2");
iconBuffer[ 3] = par1IconRegister.registerIcon("warpdrive:particleBoosterSide3");
iconBuffer[ 4] = par1IconRegister.registerIcon("warpdrive:particleBoosterSide4");
iconBuffer[ 5] = par1IconRegister.registerIcon("warpdrive:particleBoosterSide5");
iconBuffer[ 6] = par1IconRegister.registerIcon("warpdrive:particleBoosterSide6");
iconBuffer[ 7] = par1IconRegister.registerIcon("warpdrive:particleBoosterSide7");
iconBuffer[ 8] = par1IconRegister.registerIcon("warpdrive:particleBoosterSide8");
iconBuffer[ 9] = par1IconRegister.registerIcon("warpdrive:particleBoosterSide9");
iconBuffer[10] = par1IconRegister.registerIcon("warpdrive:particleBoosterSide10");
iconBuffer[11] = par1IconRegister.registerIcon("warpdrive:particleBoosterTopBottom");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[16];
iconBuffer[ 0] = par1IconRegister.registerIcon("warpdrive:particleBoosterSide0");
iconBuffer[ 1] = par1IconRegister.registerIcon("warpdrive:particleBoosterSide1");
iconBuffer[ 2] = par1IconRegister.registerIcon("warpdrive:particleBoosterSide2");
iconBuffer[ 3] = par1IconRegister.registerIcon("warpdrive:particleBoosterSide3");
iconBuffer[ 4] = par1IconRegister.registerIcon("warpdrive:particleBoosterSide4");
iconBuffer[ 5] = par1IconRegister.registerIcon("warpdrive:particleBoosterSide5");
iconBuffer[ 6] = par1IconRegister.registerIcon("warpdrive:particleBoosterSide6");
iconBuffer[ 7] = par1IconRegister.registerIcon("warpdrive:particleBoosterSide7");
iconBuffer[ 8] = par1IconRegister.registerIcon("warpdrive:particleBoosterSide8");
iconBuffer[ 9] = par1IconRegister.registerIcon("warpdrive:particleBoosterSide9");
iconBuffer[10] = par1IconRegister.registerIcon("warpdrive:particleBoosterSide10");
iconBuffer[11] = par1IconRegister.registerIcon("warpdrive:particleBoosterTopBottom");
}
@Override
public IIcon getIcon(int side, int metadata) {
if (side == 0 || side == 1) {
return iconBuffer[11];
}
@Override
public IIcon getIcon(int side, int metadata) {
if (side == 0 || side == 1) {
return iconBuffer[11];
}
return iconBuffer[metadata];
}
return iconBuffer[metadata];
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityParticleBooster();
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityParticleBooster();
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
* Called upon block activation (right click on the block.)
*/
@Override
/**
* Called upon block activation (right click on the block.)
*/
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return false;
}
if (par5EntityPlayer.getHeldItem() == null) {
TileEntity te = par1World.getTileEntity(par2, par3, par4);
if (te != null && te instanceof WarpEnergyTE) {
@ -88,7 +89,7 @@ public class BlockParticleBooster extends BlockContainer {
return true;
}
}
return false;
}
}

View file

@ -10,6 +10,7 @@ public class BlockPowerLaser extends WarpBlockContainer {
public BlockPowerLaser() {
setResistance(100.0F);
setBlockName("warpdrive.power.Laser");
}
@Override

View file

@ -11,6 +11,7 @@ public class BlockPowerReactor extends WarpBlockContainer {
public BlockPowerReactor() {
super();
setBlockName("warpdrive.power.Reactor");
}
@Override

View file

@ -12,6 +12,7 @@ public class BlockPowerStore extends WarpBlockContainer {
private IIcon iconBuffer;
public BlockPowerStore() {
setBlockName("warpdrive.power.Store");
}
@Override

View file

@ -22,90 +22,91 @@ public class BlockProtocol extends BlockContainer {
private final int ICON_INACTIVE_SIDE = 0, ICON_BOTTOM = 1, ICON_TOP = 2, ICON_SIDE_ACTIVATED = 3;
public BlockProtocol(int id, Material material) {
super(material);
setHardness(0.5F);
public BlockProtocol(int id, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
}
setBlockName("warpdrive.machines.WarpProtocol");
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[10];
// Solid textures
iconBuffer[ICON_INACTIVE_SIDE] = par1IconRegister.registerIcon("warpdrive:contSideInactive");
iconBuffer[ICON_BOTTOM] = par1IconRegister.registerIcon("warpdrive:contBottom");
iconBuffer[ICON_TOP] = par1IconRegister.registerIcon("warpdrive:contTop");
// Animated textures
iconBuffer[ICON_SIDE_ACTIVATED ] = par1IconRegister.registerIcon("warpdrive:contSideActive0");
iconBuffer[ICON_SIDE_ACTIVATED + 1] = par1IconRegister.registerIcon("warpdrive:contSideActive1");
iconBuffer[ICON_SIDE_ACTIVATED + 2] = par1IconRegister.registerIcon("warpdrive:contSideActive2");
iconBuffer[ICON_SIDE_ACTIVATED + 3] = par1IconRegister.registerIcon("warpdrive:contSideActive3");
iconBuffer[ICON_SIDE_ACTIVATED + 4] = par1IconRegister.registerIcon("warpdrive:contSideActive4");
iconBuffer[ICON_SIDE_ACTIVATED + 5] = par1IconRegister.registerIcon("warpdrive:contSideActive5");
iconBuffer[ICON_SIDE_ACTIVATED + 6] = par1IconRegister.registerIcon("warpdrive:contSideActive6");
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[10];
// Solid textures
iconBuffer[ICON_INACTIVE_SIDE] = par1IconRegister.registerIcon("warpdrive:contSideInactive");
iconBuffer[ICON_BOTTOM] = par1IconRegister.registerIcon("warpdrive:contBottom");
iconBuffer[ICON_TOP] = par1IconRegister.registerIcon("warpdrive:contTop");
// Animated textures
iconBuffer[ICON_SIDE_ACTIVATED ] = par1IconRegister.registerIcon("warpdrive:contSideActive0");
iconBuffer[ICON_SIDE_ACTIVATED + 1] = par1IconRegister.registerIcon("warpdrive:contSideActive1");
iconBuffer[ICON_SIDE_ACTIVATED + 2] = par1IconRegister.registerIcon("warpdrive:contSideActive2");
iconBuffer[ICON_SIDE_ACTIVATED + 3] = par1IconRegister.registerIcon("warpdrive:contSideActive3");
iconBuffer[ICON_SIDE_ACTIVATED + 4] = par1IconRegister.registerIcon("warpdrive:contSideActive4");
iconBuffer[ICON_SIDE_ACTIVATED + 5] = par1IconRegister.registerIcon("warpdrive:contSideActive5");
iconBuffer[ICON_SIDE_ACTIVATED + 6] = par1IconRegister.registerIcon("warpdrive:contSideActive6");
}
@Override
public IIcon getIcon(int side, int metadata) {
if (side == 0) {
return iconBuffer[ICON_BOTTOM];
} else if (side == 1) {
return iconBuffer[ICON_TOP];
}
@Override
public IIcon getIcon(int side, int metadata) {
if (side == 0) {
return iconBuffer[ICON_BOTTOM];
} else if (side == 1) {
return iconBuffer[ICON_TOP];
}
if (metadata == 0) { // Inactive state
return iconBuffer[ICON_INACTIVE_SIDE];
} else if (metadata > 0) { // Activated, in metadata stored mode number
if (metadata == 0) { // Inactive state
return iconBuffer[ICON_INACTIVE_SIDE];
} else if (metadata > 0) { // Activated, in metadata stored mode number
if (ICON_SIDE_ACTIVATED + metadata - 1 < iconBuffer.length) {
return iconBuffer[ICON_SIDE_ACTIVATED + metadata];
} else {
return null;
}
}
return null;
}
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityProtocol();
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityProtocol();
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
* Called upon block activation (right click on the block.)
*/
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return false;
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
* Called upon block activation (right click on the block.)
*/
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return false;
}
if (par5EntityPlayer.getHeldItem() == null) {
TileEntityProtocol controller = (TileEntityProtocol)par1World.getTileEntity(par2, par3, par4);
if (controller != null) {
controller.attachPlayer(par5EntityPlayer);
par5EntityPlayer.addChatMessage(new ChatComponentText(controller.getBlockType().getLocalizedName() + " Attached players: " + controller.getAttachedPlayersList()));
return true;
}
}
if (par5EntityPlayer.getHeldItem() == null) {
TileEntityProtocol controller = (TileEntityProtocol)par1World.getTileEntity(par2, par3, par4);
if (controller != null) {
controller.attachPlayer(par5EntityPlayer);
par5EntityPlayer.addChatMessage(new ChatComponentText(controller.getBlockType().getLocalizedName() + " Attached players: " + controller.getAttachedPlayersList()));
return true;
}
}
return false;
}
return false;
}
}

View file

@ -17,83 +17,84 @@ import cr0s.warpdrive.WarpDrive;
public class BlockRadar extends BlockContainer
{
private IIcon[] iconBuffer;
private IIcon[] iconBuffer;
private final int ICON_SIDE_INACTIVE = 0;
private final int ICON_BOTTOM = 1;
private final int ICON_TOP = 2;
private final int ICON_SIDE_ACTIVATED = 3;
private final int ICON_SIDE_ACTIVATED_SCAN = 4;
private final int ICON_SIDE_INACTIVE = 0;
private final int ICON_BOTTOM = 1;
private final int ICON_TOP = 2;
private final int ICON_SIDE_ACTIVATED = 3;
private final int ICON_SIDE_ACTIVATED_SCAN = 4;
public BlockRadar(int texture, Material material) {
super(material);
setHardness(0.5F);
public BlockRadar(int texture, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
}
setBlockName("warpdrive.machines.WarpRadar");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[16];
iconBuffer[ICON_SIDE_INACTIVE] = par1IconRegister.registerIcon("warpdrive:radarSideInactive");
iconBuffer[ICON_BOTTOM] = par1IconRegister.registerIcon("warpdrive:contBottom");
iconBuffer[ICON_TOP] = par1IconRegister.registerIcon("warpdrive:contTop");
iconBuffer[ICON_SIDE_ACTIVATED] = par1IconRegister.registerIcon("warpdrive:radarSideActive");
iconBuffer[ICON_SIDE_ACTIVATED_SCAN] = par1IconRegister.registerIcon("warpdrive:radarSideActiveScan");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[16];
iconBuffer[ICON_SIDE_INACTIVE] = par1IconRegister.registerIcon("warpdrive:radarSideInactive");
iconBuffer[ICON_BOTTOM] = par1IconRegister.registerIcon("warpdrive:contBottom");
iconBuffer[ICON_TOP] = par1IconRegister.registerIcon("warpdrive:contTop");
iconBuffer[ICON_SIDE_ACTIVATED] = par1IconRegister.registerIcon("warpdrive:radarSideActive");
iconBuffer[ICON_SIDE_ACTIVATED_SCAN] = par1IconRegister.registerIcon("warpdrive:radarSideActiveScan");
}
@Override
public IIcon getIcon(int side, int metadata) {
if (side == 0) {
return iconBuffer[ICON_BOTTOM];
} else if (side == 1) {
return iconBuffer[ICON_TOP];
}
@Override
public IIcon getIcon(int side, int metadata) {
if (side == 0) {
return iconBuffer[ICON_BOTTOM];
} else if (side == 1) {
return iconBuffer[ICON_TOP];
}
if (metadata == 0) {// Inactive state
return iconBuffer[ICON_SIDE_INACTIVE];
} else if (metadata == 1) { // Attached state
return iconBuffer[ICON_SIDE_ACTIVATED];
} else if (metadata == 2) { // Scanning state
return iconBuffer[ICON_SIDE_ACTIVATED_SCAN];
}
if (metadata == 0) {// Inactive state
return iconBuffer[ICON_SIDE_INACTIVE];
} else if (metadata == 1) { // Attached state
return iconBuffer[ICON_SIDE_ACTIVATED];
} else if (metadata == 2) { // Scanning state
return iconBuffer[ICON_SIDE_ACTIVATED_SCAN];
}
return iconBuffer[ICON_SIDE_INACTIVE];
}
return iconBuffer[ICON_SIDE_INACTIVE];
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityRadar();
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityRadar();
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return false;
}
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return false;
}
WarpEnergyTE te = (WarpEnergyTE)par1World.getTileEntity(par2, par3, par4);
if (te != null && (par5EntityPlayer.getHeldItem() == null)) {
par5EntityPlayer.addChatMessage(new ChatComponentText(te.getStatus()));
return true;
}
WarpEnergyTE te = (WarpEnergyTE)par1World.getTileEntity(par2, par3, par4);
if (te != null && (par5EntityPlayer.getHeldItem() == null)) {
par5EntityPlayer.addChatMessage(new ChatComponentText(te.getStatus()));
return true;
}
return false;
}
return false;
}
}

View file

@ -16,94 +16,95 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cr0s.warpdrive.WarpDrive;
public class BlockReactor extends BlockContainer {
private IIcon[] iconBuffer;
private IIcon[] iconBuffer;
private final int ICON_SIDE_INACTIVE = 0, ICON_BOTTOM = 1, ICON_TOP = 2, ICON_SIDE_ACTIVATED = 3, ICON_SIDE_HEATED = 4;
private final int ICON_SIDE_INACTIVE = 0, ICON_BOTTOM = 1, ICON_TOP = 2, ICON_SIDE_ACTIVATED = 3, ICON_SIDE_HEATED = 4;
public BlockReactor(int texture, Material material) {
super(material);
setHardness(0.5F);
public BlockReactor(int texture, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
}
setBlockName("warpdrive.machines.WarpCore");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[5];
iconBuffer[ICON_SIDE_INACTIVE] = par1IconRegister.registerIcon("warpdrive:coreSideInactive");
iconBuffer[ICON_BOTTOM] = par1IconRegister.registerIcon("warpdrive:coreBottom");
iconBuffer[ICON_TOP] = par1IconRegister.registerIcon("warpdrive:coreTop");
iconBuffer[ICON_SIDE_ACTIVATED] = par1IconRegister.registerIcon("warpdrive:coreSideActive");
iconBuffer[ICON_SIDE_HEATED] = par1IconRegister.registerIcon("warpdrive:coreSideHeated");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[5];
iconBuffer[ICON_SIDE_INACTIVE] = par1IconRegister.registerIcon("warpdrive:coreSideInactive");
iconBuffer[ICON_BOTTOM] = par1IconRegister.registerIcon("warpdrive:coreBottom");
iconBuffer[ICON_TOP] = par1IconRegister.registerIcon("warpdrive:coreTop");
iconBuffer[ICON_SIDE_ACTIVATED] = par1IconRegister.registerIcon("warpdrive:coreSideActive");
iconBuffer[ICON_SIDE_HEATED] = par1IconRegister.registerIcon("warpdrive:coreSideHeated");
}
@Override
public IIcon getIcon(int side, int metadata) {
if (side == 0) {
return iconBuffer[ICON_BOTTOM];
} else if (side == 1) {
return iconBuffer[ICON_TOP];
}
@Override
public IIcon getIcon(int side, int metadata) {
if (side == 0) {
return iconBuffer[ICON_BOTTOM];
} else if (side == 1) {
return iconBuffer[ICON_TOP];
}
if (metadata == 0) { // Inactive state
return iconBuffer[ICON_SIDE_INACTIVE];
} else if (metadata == 1) { // Activated state
return iconBuffer[ICON_SIDE_ACTIVATED];
} else if (metadata == 2) { // Heated state
return iconBuffer[ICON_SIDE_HEATED];
}
if (metadata == 0) { // Inactive state
return iconBuffer[ICON_SIDE_INACTIVE];
} else if (metadata == 1) { // Activated state
return iconBuffer[ICON_SIDE_ACTIVATED];
} else if (metadata == 2) { // Heated state
return iconBuffer[ICON_SIDE_HEATED];
}
return null;
}
return null;
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityReactor();
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityReactor();
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
* Called upon block activation (right click on the block.)
*/
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return false;
}
/**
* Called upon block activation (right click on the block.)
*/
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return false;
}
if (par5EntityPlayer.getHeldItem() == null) {
TileEntity te = par1World.getTileEntity(par2, par3, par4);
if (te != null && te instanceof TileEntityReactor) {
par5EntityPlayer.addChatMessage(new ChatComponentText(((TileEntityReactor)te).getStatus()));
return true;
}
}
if (par5EntityPlayer.getHeldItem() == null) {
TileEntity te = par1World.getTileEntity(par2, par3, par4);
if (te != null && te instanceof TileEntityReactor) {
par5EntityPlayer.addChatMessage(new ChatComponentText(((TileEntityReactor)te).getStatus()));
return true;
}
}
return false;
}
return false;
}
@Override
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
TileEntity te = par1World.getTileEntity(par2, par3, par4);
if (te != null && te instanceof TileEntityReactor) {
WarpDrive.warpCores.removeFromRegistry((TileEntityReactor)te);
}
@Override
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
TileEntity te = par1World.getTileEntity(par2, par3, par4);
if (te != null && te instanceof TileEntityReactor) {
WarpDrive.warpCores.removeFromRegistry((TileEntityReactor)te);
}
super.breakBlock(par1World, par2, par3, par4, par5, par6);
}
super.breakBlock(par1World, par2, par3, par4, par5, par6);
}
}

View file

@ -16,70 +16,71 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cr0s.warpdrive.WarpDrive;
public class BlockShipScanner extends BlockContainer {
private IIcon[] iconBuffer;
private IIcon[] iconBuffer;
public BlockShipScanner(int texture, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
}
public BlockShipScanner(int texture, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
setBlockName("warpdrive.machines.Scanner");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[3];
iconBuffer[0] = par1IconRegister.registerIcon("warpdrive:shipScannerUp");
iconBuffer[1] = par1IconRegister.registerIcon("warpdrive:shipScannerSide");
iconBuffer[2] = par1IconRegister.registerIcon("warpdrive:contBottom");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[3];
iconBuffer[0] = par1IconRegister.registerIcon("warpdrive:shipScannerUp");
iconBuffer[1] = par1IconRegister.registerIcon("warpdrive:shipScannerSide");
iconBuffer[2] = par1IconRegister.registerIcon("warpdrive:contBottom");
}
@Override
public IIcon getIcon(int side, int metadata) {
if (side == 1) { // UP
return iconBuffer[0];
} else if (side == 0) { // DOWN
return iconBuffer[2];
}
@Override
public IIcon getIcon(int side, int metadata) {
if (side == 1) { // UP
return iconBuffer[0];
} else if (side == 0) { // DOWN
return iconBuffer[2];
}
return iconBuffer[1];
}
return iconBuffer[1];
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityShipScanner();
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityShipScanner();
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
* Called upon block activation (right click on the block.)
*/
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return false;
}
/**
* Called upon block activation (right click on the block.)
*/
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return false;
}
WarpEnergyTE te = (WarpEnergyTE)par1World.getTileEntity(par2, par3, par4);
if (te != null && (par5EntityPlayer.getHeldItem() == null)) {
par5EntityPlayer.addChatMessage(new ChatComponentText(te.getStatus()));
return true;
}
WarpEnergyTE te = (WarpEnergyTE)par1World.getTileEntity(par2, par3, par4);
if (te != null && (par5EntityPlayer.getHeldItem() == null)) {
par5EntityPlayer.addChatMessage(new ChatComponentText(te.getStatus()));
return true;
}
return false;
}
return false;
}
}

View file

@ -12,6 +12,7 @@ public class BlockTransporter extends WarpBlockContainer {
public BlockTransporter(Material par2Material) {
super(par2Material);
setBlockName("warpdrive.machines.Transporter");
}
@Override

View file

@ -10,39 +10,40 @@ import net.minecraft.util.IIcon;
import cr0s.warpdrive.WarpDrive;
public class BlockWarpIsolation extends Block {
private IIcon[] iconBuffer;
private IIcon[] iconBuffer;
public BlockWarpIsolation(int texture, Material material) {
super(material);
setHardness(0.5F);
public BlockWarpIsolation(int texture, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
}
setBlockName("warpdrive.blocks.WarpIsolation");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[1];
iconBuffer[0] = par1IconRegister.registerIcon("warpdrive:warpIsolation");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[1];
iconBuffer[0] = par1IconRegister.registerIcon("warpdrive:warpIsolation");
}
@Override
public IIcon getIcon(int side, int metadata) {
return iconBuffer[0];
}
@Override
public IIcon getIcon(int side, int metadata) {
return iconBuffer[0];
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
}

View file

@ -22,6 +22,7 @@ tile.warpdrive.blocks.Air.name=Air Block
tile.warpdrive.blocks.Gas.name=Gas Block
tile.warpdrive.blocks.WarpIsolation.name=Warp-field Isolation Block
tile.warpdrive.blocks.IridiumBlock.name=Iridium Block
tile.warpdrive.blocks.TransportBeacon.name=Transport Beacon
tile.warpdrive.decorative.Plain.name=Plain Block
tile.warpdrive.decorative.Energized.name=Energized Block