Updated blocks to 1.7.10

Also finished update of main class
This commit is contained in:
Francesco Macagno 2015-07-15 22:15:57 -07:00
parent 49a645f3f0
commit a64b8da1ae
22 changed files with 323 additions and 366 deletions

View file

@ -236,7 +236,7 @@ public class WarpDrive implements LoadingCallback {
GameRegistry.registerBlock(airBlock, "airBlock");
// GAS Block
gasBlock = (new BlockGas());
gasBlock = new BlockGas();
GameRegistry.registerBlock(gasBlock, "gasBlock");
@ -460,7 +460,7 @@ public class WarpDrive implements LoadingCallback {
'n', Items.gold_nugget));
//Helmet
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(helmetItems), false, "iii", "iwi", "gcg",
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(helmetItem), false, "iii", "iwi", "gcg",
'i', Items.iron_ingot,
'w', Blocks.wool,
'g', Blocks.glass,

View file

@ -7,6 +7,7 @@ import javax.swing.Icon;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
@ -24,7 +25,6 @@ public class BlockAir extends Block
public BlockAir() {
super(Material.air);
setHardness(0.0F);
setUnlocalizedName("warpdrive.blocks.Air");this.isRe
}
@Override
@ -132,7 +132,7 @@ public class BlockAir extends Block
// Remove air block to vacuum block
if (concentration <= 0 || !isInSpaceWorld) {
par1World.setBlock(x, y, z, 0, 0, 3); // replace our air block to vacuum block
par1World.setBlock(x, y, z, Blocks.air, 0, 3); // replace our air block to vacuum block
} else {
// Try to spread the air
spreadAirBlock(par1World, x, y, z, concentration);
@ -154,15 +154,15 @@ public class BlockAir extends Block
return world.isAirBlock(x, y, z);
}
private void spreadAirBlock(World worldObj, int x, int y, int z, int concentration) {
private void spreadAirBlock(World world, int x, int y, int z, int concentration) {
int air_count = 1;
int empty_count = 0;
int sum_concentration = concentration;
// Count air in adjacent blocks
Block xp_block = worldObj.getBlock(x + 1, y, z);
boolean xp_isAir = WarpDriveConfig.isAirBlock(worldObj, xp_block, x + 1, y, z);;
int xp_concentration = (xp_block.isAssociatedBlock(this)) ? 0 : worldObj.getBlockMetadata(x + 1, y, z);
Block xp_block = world.getBlock(x + 1, y, z);
boolean xp_isAir = world.isAirBlock(x + 1, y, z);;
int xp_concentration = (xp_block.isAssociatedBlock(this)) ? 0 : world.getBlockMetadata(x + 1, y, z);
if (xp_isAir) {
air_count++;
if (xp_concentration > 0) {
@ -171,9 +171,9 @@ public class BlockAir extends Block
empty_count++;
}
}
int xn_blockId = worldObj.getBlockId(x - 1, y, z);
boolean xn_isAir = WarpDriveConfig.isAirBlock(worldObj, xn_blockId, x - 1, y, z);
int xn_concentration = (xn_blockId != this.blockID) ? 0 : worldObj.getBlockMetadata(x - 1, y, z);
int xn_blockId = world.getBlockId(x - 1, y, z);
boolean xn_isAir = WarpDriveConfig.isAirBlock(world, xn_blockId, x - 1, y, z);
int xn_concentration = (xn_blockId != this.blockID) ? 0 : world.getBlockMetadata(x - 1, y, z);
if (xn_isAir) {
air_count++;
if (xn_concentration > 0) {
@ -182,9 +182,9 @@ public class BlockAir extends Block
empty_count++;
}
}
int yp_blockId = worldObj.getBlockId(x, y + 1, z);
boolean yp_isAir = WarpDriveConfig.isAirBlock(worldObj, yp_blockId, x, y + 1, z);
int yp_concentration = (yp_blockId != this.blockID) ? 0 : worldObj.getBlockMetadata(x, y + 1, z);
int yp_blockId = world.getBlockId(x, y + 1, z);
boolean yp_isAir = WarpDriveConfig.isAirBlock(world, yp_blockId, x, y + 1, z);
int yp_concentration = (yp_blockId != this.blockID) ? 0 : world.getBlockMetadata(x, y + 1, z);
if (yp_isAir) {
air_count++;
if (yp_concentration > 0) {
@ -193,9 +193,9 @@ public class BlockAir extends Block
empty_count++;
}
}
int yn_blockId = worldObj.getBlockId(x, y - 1, z);
boolean yn_isAir = WarpDriveConfig.isAirBlock(worldObj, yn_blockId, x, y - 1, z);
int yn_concentration = (yn_blockId != this.blockID) ? 0 : worldObj.getBlockMetadata(x, y - 1, z);
int yn_blockId = world.getBlockId(x, y - 1, z);
boolean yn_isAir = WarpDriveConfig.isAirBlock(world, yn_blockId, x, y - 1, z);
int yn_concentration = (yn_blockId != this.blockID) ? 0 : world.getBlockMetadata(x, y - 1, z);
if (yn_isAir) {
air_count++;
if (yn_concentration > 0) {
@ -204,9 +204,9 @@ public class BlockAir extends Block
empty_count++;
}
}
int zp_blockId = worldObj.getBlockId(x, y, z + 1);
boolean zp_isAir = WarpDriveConfig.isAirBlock(worldObj, zp_blockId, x, y, z + 1);
int zp_concentration = (zp_blockId != this.blockID) ? 0 : worldObj.getBlockMetadata(x, y, z + 1);
int zp_blockId = world.getBlockId(x, y, z + 1);
boolean zp_isAir = WarpDriveConfig.isAirBlock(world, zp_blockId, x, y, z + 1);
int zp_concentration = (zp_blockId != this.blockID) ? 0 : world.getBlockMetadata(x, y, z + 1);
if (zp_isAir) {
air_count++;
if (zp_concentration > 0) {
@ -215,9 +215,9 @@ public class BlockAir extends Block
empty_count++;
}
}
int zn_blockId = worldObj.getBlockId(x, y, z - 1);
boolean zn_isAir = WarpDriveConfig.isAirBlock(worldObj, zn_blockId, x, y, z - 1);
int zn_concentration = (zn_blockId != this.blockID) ? 0 : worldObj.getBlockMetadata(x, y, z - 1);
int zn_blockId = world.getBlockId(x, y, z - 1);
boolean zn_isAir = WarpDriveConfig.isAirBlock(world, zn_blockId, x, y, z - 1);
int zn_concentration = (zn_blockId != this.blockID) ? 0 : world.getBlockMetadata(x, y, z - 1);
if (zn_isAir) {
air_count++;
if (zn_concentration > 0) {
@ -231,7 +231,7 @@ public class BlockAir extends Block
if (concentration < 8) {
sum_concentration -= empty_count;
} else if (concentration < 4) {
sum_concentration -= empty_count + (worldObj.rand.nextBoolean() ? 0 : empty_count);
sum_concentration -= empty_count + (world.rand.nextBoolean() ? 0 : empty_count);
} else {
sum_concentration -= 1;
}
@ -248,7 +248,7 @@ public class BlockAir extends Block
&& (yp_blockId != WarpDriveConfig.airgenID) && (yn_blockId != WarpDriveConfig.airgenID)
&& (zp_blockId != WarpDriveConfig.airgenID) && (zn_blockId != WarpDriveConfig.airgenID) ) {
// WarpDrive.debugPrint("AirGenerator not found, removing air block at " + x + ", " + y + ", " + z);
worldObj.setBlockMetadataWithNotify(x, y, z, 1, 2);
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
} else {
// keep the block as a source
/* WarpDrive.debugPrint("15 + "
@ -257,7 +257,7 @@ public class BlockAir extends Block
+ zp_concentration + " " + zn_concentration + " = " + sum_concentration + " total, " + empty_count + " empty / " + air_count + " -> " + new_concentration);/**/
}
} else {
worldObj.setBlockMetadataWithNotify(x, y, z, new_concentration, 2);
world.setBlockMetadataWithNotify(x, y, z, new_concentration, 2);
}
}
@ -265,70 +265,64 @@ public class BlockAir extends Block
if (xp_isAir) {
if (xp_blockId == this.blockID) {
if (xp_concentration != mid_concentration && xp_concentration != 15) {
worldObj.setBlockMetadataWithNotify(x + 1, y, z, mid_concentration, 2);
world.setBlockMetadataWithNotify(x + 1, y, z, mid_concentration, 2);
}
} else {
worldObj.setBlock(x + 1, y, z, this.blockID, mid_concentration, 2);
world.setBlock(x + 1, y, z, this.blockID, mid_concentration, 2);
}
}
if (xn_isAir) {
if (xn_blockId == this.blockID) {
if (xn_concentration != mid_concentration && xn_concentration != 15) {
worldObj.setBlockMetadataWithNotify(x - 1, y, z, mid_concentration, 2);
world.setBlockMetadataWithNotify(x - 1, y, z, mid_concentration, 2);
}
} else {
worldObj.setBlock(x - 1, y, z, this.blockID, mid_concentration, 2);
world.setBlock(x - 1, y, z, this.blockID, mid_concentration, 2);
}
}
if (yp_isAir) {
if (yp_blockId == this.blockID) {
if (yp_concentration != mid_concentration && yp_concentration != 15) {
worldObj.setBlockMetadataWithNotify(x, y + 1, z, mid_concentration, 2);
world.setBlockMetadataWithNotify(x, y + 1, z, mid_concentration, 2);
}
} else {
worldObj.setBlock(x, y + 1, z, this.blockID, mid_concentration, 2);
world.setBlock(x, y + 1, z, this.blockID, mid_concentration, 2);
}
}
if (yn_isAir) {
if (yn_blockId == this.blockID) {
if (yn_concentration != mid_concentration && yn_concentration != 15) {
worldObj.setBlockMetadataWithNotify(x, y - 1, z, mid_concentration, 2);
world.setBlockMetadataWithNotify(x, y - 1, z, mid_concentration, 2);
}
} else {
worldObj.setBlock(x, y - 1, z, this.blockID, mid_concentration, 2);
world.setBlock(x, y - 1, z, this.blockID, mid_concentration, 2);
}
}
if (zp_isAir) {
if (zp_blockId == this.blockID) {
if (zp_concentration != mid_concentration && zp_concentration != 15) {
worldObj.setBlockMetadataWithNotify(x, y, z + 1, mid_concentration, 2);
world.setBlockMetadataWithNotify(x, y, z + 1, mid_concentration, 2);
}
} else {
worldObj.setBlock(x, y, z + 1, this.blockID, mid_concentration, 2);
world.setBlock(x, y, z + 1, this.blockID, mid_concentration, 2);
}
}
if (zn_isAir) {
if (zn_blockId == this.blockID) {
if (zn_concentration != mid_concentration && zn_concentration != 15) {
worldObj.setBlockMetadataWithNotify(x, y, z - 1, mid_concentration, 2);
world.setBlockMetadataWithNotify(x, y, z - 1, mid_concentration, 2);
}
} else {
worldObj.setBlock(x, y, z - 1, this.blockID, mid_concentration, 2);
world.setBlock(x, y, z - 1, this.blockID, mid_concentration, 2);
}
}
}
// Used to prevent updates on chunk generation
@Override
public boolean func_82506_l() {
return false;
}
/**
* Returns if this block is collidable. Args: x, y, z
*/
@ -340,7 +334,7 @@ public class BlockAir extends Block
@Override
public void onBlockAdded(World par1World, int par2, int par3, int par4) {
if (par1World.provider.dimensionId == WarpDriveConfig.G_SPACE_DIMENSION_ID || par1World.provider.dimensionId == WarpDriveConfig.G_HYPERSPACE_DIMENSION_ID) {
par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, this.tickRate(par1World));
par1World.scheduleBlockUpdate(par2, par3, par4, this, this.tickRate(par1World));
} else {
par1World.setBlockToAir(par2, par3, par4);
}

View file

@ -2,22 +2,22 @@ package cr0s.warpdrive.block;
import java.util.Random;
import javax.swing.Icon;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cr0s.warpdrive.WarpDriveConfig;
public class BlockGas extends Block {
private Icon[] gasIcons;
private IIcon[] gasIcons;
public BlockGas(int par1) {
super(par1, Material.air);
public BlockGas() {
super(Material.air);
setHardness(0.0F);
setUnlocalizedName("warpdrive.blocks.Gas");
}
@Override
@ -26,7 +26,7 @@ public class BlockGas extends Block {
}
@Override
public boolean isAirBlock(World var1, int var2, int var3, int var4) {
public boolean isAir(IBlockAccess var1, int var2, int var3, int var4) {
return true;
}
@ -36,7 +36,7 @@ public class BlockGas extends Block {
}
@Override
public boolean isBlockReplaceable(World var1, int var2, int var3, int var4) {
public boolean isReplaceable(IBlockAccess var1, int var2, int var3, int var4) {
return true;
}
@ -56,8 +56,8 @@ public class BlockGas extends Block {
}
@Override
public void registerIcons(IconRegister par1IconRegister) {
gasIcons = new Icon[12];
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");
@ -73,7 +73,7 @@ public class BlockGas extends Block {
}
@Override
public Icon getIcon(int side, int metadata) {
public IIcon getIcon(int side, int metadata) {
return gasIcons[metadata % gasIcons.length]; // Lem
}
@ -83,13 +83,10 @@ public class BlockGas extends Block {
}
@Override
public int idDropped(int var1, Random var2, int var3) {
return -1;
public Item getItemDropped(int var1, Random var2, int var3) {
return null;
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 0;
@ -97,22 +94,13 @@ public class BlockGas extends Block {
@Override
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
int sideBlockID = world.getBlockId(x, y, z);
if (sideBlockID == this.blockID) {
Block sideBlock = world.getBlock(x, y, z);
if (sideBlock.isAssociatedBlock(this)) {
return false;
}
return world.isAirBlock(x, y, z);
}
@Override
public boolean func_82506_l()
{
return false;
}
/**
* Returns if this block is collidable. Args: x, y, z
*/
@Override
public boolean isCollidable() {
return false;

View file

@ -2,17 +2,19 @@ package cr0s.warpdrive.item;
import javax.swing.Icon;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.util.IIcon;
import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.api.IAirCanister;
public class ItemWarpAirCanister extends Item implements IAirCanister {
Icon icon;
public ItemWarpAirCanister(int id) {
super(id);
private IIcon icon;
public ItemWarpAirCanister() {
super();
setMaxDamage(20);
setCreativeTab(WarpDrive.warpdriveTab);
setMaxStackSize(1);
@ -20,14 +22,12 @@ public class ItemWarpAirCanister extends Item implements IAirCanister {
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister ir) {
public void registerIcons(IIconRegister ir) {
icon = ir.registerIcon("warpdrive:componentAirCanisterFull");
}
@Override
@SideOnly(Side.CLIENT)
public Icon getIconFromDamage(int damage) {
public IIcon getIconFromDamage(int damage) {
return icon;
}

View file

@ -2,11 +2,13 @@ package cr0s.warpdrive.item;
import javax.swing.Icon;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import cr0s.warpdrive.WarpDrive;
@ -17,10 +19,10 @@ public class ItemWarpArmor extends ItemArmor implements IBreathingHelmet {
// private static Random ran = new Random();
private int slot;
Icon ic;
IIcon ic;
public ItemWarpArmor(int id,int slot) {
super(id, WarpDrive.armorMaterial, 0, slot);
public ItemWarpArmor(int slot) {
super(WarpDrive.armorMaterial, 0, slot);
this.slot = slot;
setUnlocalizedName("warpdrive.armor.Helmet");
setCreativeTab(WarpDrive.warpdriveTab);
@ -33,16 +35,14 @@ public class ItemWarpArmor extends ItemArmor implements IBreathingHelmet {
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister ir) {
public void registerIcons(IIconRegister ir) {
if (slot == 0) {
ic = ir.registerIcon("warpdrive:warpArmorHelmet");
}
}
@Override
@SideOnly(Side.CLIENT)
public Icon getIconFromDamage(int damage) {
public IIcon getIconFromDamage(int damage) {
return ic;
}

View file

@ -20,8 +20,8 @@ public class ItemWarpComponent extends Item implements IAirCanister {
private String[] potentialUnlocalized = new String[9];
private ItemStack[] cachedIS;
public ItemWarpComponent(int par1) {
super(par1);
public ItemWarpComponent() {
super();
setHasSubtypes(true);
setUnlocalizedName("warpdrive.crafting.Malformed");
setCreativeTab(WarpDrive.warpdriveTab);

View file

@ -2,51 +2,48 @@ package cr0s.warpdrive.machines;
import java.util.Random;
import javax.swing.Icon;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.WarpDriveConfig;
import cr0s.warpdrive.api.IAirCanister;
public class BlockAirGenerator extends BlockContainer
{
private Icon[] iconBuffer;
private IIcon[] iconBuffer;
private final int ICON_INACTIVE_SIDE = 0, ICON_BOTTOM = 1, ICON_SIDE_ACTIVATED = 2;
public BlockAirGenerator(int id, int texture, Material material)
public BlockAirGenerator(int texture, Material material)
{
super(id, material);
super(material);
setHardness(0.5F);
setStepSound(Block.soundMetalFootstep);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
setUnlocalizedName("warpdrive.machines.AirGenerator");
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister)
public void registerBlockIcons(IIconRegister par1IconRegister)
{
iconBuffer = new Icon[3];
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 Icon getIcon(int side, int metadata) {
public IIcon getIcon(int side, int metadata) {
if (side == 0) {
return iconBuffer[ICON_BOTTOM];
} else if (side == 1) {
@ -67,7 +64,7 @@ public class BlockAirGenerator extends BlockContainer
}
@Override
public TileEntity createNewTileEntity(World var1) {
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityAirGenerator();
}
@ -83,8 +80,8 @@ public class BlockAirGenerator extends BlockContainer
* Returns the ID of the items to drop on destruction.
*/
@Override
public int idDropped(int par1, Random par2Random, int par3) {
return this.blockID;
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
@Override
@ -93,11 +90,11 @@ public class BlockAirGenerator extends BlockContainer
return false;
}
WarpEnergyTE te = (WarpEnergyTE)par1World.getBlockTileEntity(par2, par3, par4);
WarpEnergyTE te = (WarpEnergyTE)par1World.getTileEntity(par2, par3, par4);
if (te != null) {
ItemStack heldItemStack = player.getHeldItem();
if (heldItemStack == null) {
player.addChatMessage(te.getStatus());
player.addChatMessage(new ChatComponentText(te.getStatus()));
return true;
} else {
Item heldItem = heldItemStack.getItem();

View file

@ -2,48 +2,46 @@ package cr0s.warpdrive.machines;
import java.util.Random;
import javax.swing.Icon;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.data.CamRegistryItem;
public class BlockCamera extends BlockContainer {
private Icon[] iconBuffer;
private IIcon[] iconBuffer;
private final int ICON_SIDE = 0;
public BlockCamera(int id, int texture, Material material) {
super(id, material);
public BlockCamera(int texture, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundMetalFootstep);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
setUnlocalizedName("warpdrive.machines.Camera");
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
iconBuffer = new Icon[1];
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[1];
// Solid textures
iconBuffer[ICON_SIDE] = par1IconRegister.registerIcon("warpdrive:cameraSide");
}
@Override
public Icon getIcon(int side, int metadata) {
public IIcon getIcon(int side, int metadata) {
return iconBuffer[ICON_SIDE];
}
@Override
public TileEntity createNewTileEntity(World parWorld) {
public TileEntity createNewTileEntity(World parWorld, int i) {
return new TileEntityCamera();
}
@ -59,8 +57,8 @@ public class BlockCamera extends BlockContainer {
* Returns the ID of the items to drop on destruction.
*/
@Override
public int idDropped(int par1, Random par2Random, int par3) {
return this.blockID;
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
@ -73,16 +71,16 @@ public class BlockCamera extends BlockContainer {
}
// Get camera frequency
TileEntity te = par1World.getBlockTileEntity(x, y, z);
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(getLocalizedName() + " Frequency '" + frequency + "' is invalid!");
par5EntityPlayer.addChatMessage(new ChatComponentText(getLocalizedName() + " Frequency '" + frequency + "' is invalid!"));
} else {
par5EntityPlayer.addChatMessage(getLocalizedName() + " Frequency '" + frequency + "' is valid for camera at " + cam.position.x + ", " + cam.position.y + ", " + cam.position.z);
par5EntityPlayer.addChatMessage(new ChatComponentText(getLocalizedName() + " Frequency '" + frequency + "' is valid for camera at " + cam.position.chunkPosX + ", " + cam.position.chunkPosY + ", " + cam.position.chunkPosZ));
}
return true;
}

View file

@ -2,36 +2,33 @@ package cr0s.warpdrive.machines;
import java.util.Random;
import javax.swing.Icon;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import cr0s.warpdrive.WarpDrive;
public class BlockCloakingCoil extends Block {
private Icon[] iconBuffer;
private IIcon[] iconBuffer;
public BlockCloakingCoil(int id, int texture, Material material) {
super(id, material);
public BlockCloakingCoil(int texture, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundMetalFootstep);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
setUnlocalizedName("warpdrive.machines.CloakingCoil");
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
iconBuffer = new Icon[3];
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 Icon getIcon(int side, int metadata) {
public IIcon getIcon(int side, int metadata) {
if (side == 0) {
return iconBuffer[2];
} else if (side == 1) {
@ -58,7 +55,7 @@ public class BlockCloakingCoil extends Block {
* Returns the ID of the items to drop on destruction.
*/
@Override
public int idDropped(int par1, Random par2Random, int par3) {
return this.blockID;
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
}

View file

@ -2,40 +2,38 @@ package cr0s.warpdrive.machines;
import java.util.Random;
import javax.swing.Icon;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import cr0s.warpdrive.WarpDrive;
public class BlockCloakingDeviceCore extends BlockContainer {
private Icon[] iconBuffer;
private IIcon[] iconBuffer;
public BlockCloakingDeviceCore(int id, int texture, Material material) {
super(id, material);
public BlockCloakingDeviceCore(int texture, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundMetalFootstep);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
setUnlocalizedName("warpdrive.machines.CloakingDeviceCore");
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
iconBuffer = new Icon[2];
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[2];
iconBuffer[0] = par1IconRegister.registerIcon("warpdrive:cloakingCoreInactive");
iconBuffer[1] = par1IconRegister.registerIcon("warpdrive:cloakingCoreActive");
}
@Override
public Icon getIcon(int side, int metadata) {
public IIcon getIcon(int side, int metadata) {
if (metadata < iconBuffer.length) {
return iconBuffer[metadata];
} else {
@ -44,7 +42,7 @@ public class BlockCloakingDeviceCore extends BlockContainer {
}
@Override
public TileEntity createNewTileEntity(World var1) {
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityCloakingDeviceCore();
}
@ -60,8 +58,8 @@ public class BlockCloakingDeviceCore extends BlockContainer {
* Returns the ID of the items to drop on destruction.
*/
@Override
public int idDropped(int par1, Random par2Random, int par3) {
return this.blockID;
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
@Override
@ -70,13 +68,13 @@ public class BlockCloakingDeviceCore extends BlockContainer {
return false;
}
TileEntityCloakingDeviceCore te = (TileEntityCloakingDeviceCore)par1World.getBlockTileEntity(par2, par3, par4);
TileEntityCloakingDeviceCore te = (TileEntityCloakingDeviceCore)par1World.getTileEntity(par2, par3, par4);
if (te != null && (par5EntityPlayer.getHeldItem() == null)) {
par5EntityPlayer.addChatMessage(te.getStatus() + "\n"
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!"))));
((te.isCloaking) ? "A tier " + te.tier + " cloak is currently covering " + te.volume + " blocks!" : "Cloak needs more power!")))));
return true;
}
@ -84,8 +82,8 @@ public class BlockCloakingDeviceCore extends BlockContainer {
}
@Override
public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) {
TileEntity te = par1World.getBlockTileEntity(par2, par3, par4);
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;

View file

@ -2,45 +2,42 @@ package cr0s.warpdrive.machines;
import java.util.Random;
import javax.swing.Icon;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import cr0s.warpdrive.WarpDrive;
public class BlockLaser extends BlockContainer {
private Icon[] iconBuffer;
private IIcon[] iconBuffer;
private final int ICON_SIDE = 0;
public BlockLaser(int id, int texture, Material material) {
super(id, material);
public BlockLaser(int texture, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundMetalFootstep);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
setUnlocalizedName("warpdrive.machines.Laser");
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
iconBuffer = new Icon[1];
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[1];
// Solid textures
iconBuffer[ICON_SIDE] = par1IconRegister.registerIcon("warpdrive:laserSide");
}
@Override
public Icon getIcon(int side, int metadata) {
public IIcon getIcon(int side, int metadata) {
return iconBuffer[ICON_SIDE];
}
@Override
public TileEntity createNewTileEntity(World parWorld) {
public TileEntity createNewTileEntity(World parWorld, int i) {
return new TileEntityLaser();
}
@ -56,7 +53,7 @@ public class BlockLaser extends BlockContainer {
* Returns the ID of the items to drop on destruction.
*/
@Override
public int idDropped(int par1, Random par2Random, int par3) {
return this.blockID;
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
}

View file

@ -2,48 +2,46 @@ package cr0s.warpdrive.machines;
import java.util.Random;
import javax.swing.Icon;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.data.CamRegistryItem;
public class BlockLaserCam extends BlockContainer {
private Icon[] iconBuffer;
private IIcon[] iconBuffer;
private final int ICON_SIDE = 0;
public BlockLaserCam(int id, int texture, Material material) {
super(id, material);
public BlockLaserCam(int texture, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundMetalFootstep);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
setUnlocalizedName("warpdrive.machines.LaserCamera");
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
iconBuffer = new Icon[1];
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[1];
// Solid textures
iconBuffer[ICON_SIDE] = par1IconRegister.registerIcon("warpdrive:laserSideCam");
}
@Override
public Icon getIcon(int side, int metadata) {
public IIcon getIcon(int side, int metadata) {
return iconBuffer[ICON_SIDE];
}
@Override
public TileEntity createNewTileEntity(World parWorld) {
public TileEntity createNewTileEntity(World parWorld, int i) {
return new TileEntityLaser();
}
@ -59,8 +57,8 @@ public class BlockLaserCam extends BlockContainer {
* Returns the ID of the items to drop on destruction.
*/
@Override
public int idDropped(int par1, Random par2Random, int par3) {
return this.blockID;
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
@ -73,16 +71,16 @@ public class BlockLaserCam extends BlockContainer {
}
// Get camera frequency
TileEntity te = par1World.getBlockTileEntity(x, y, z);
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(getLocalizedName()
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.x + ", " + cam.position.y + ", " + cam.position.z));
+ " Camera frequency '" + cameraFrequency + "' is " + ((cam == null) ? "invalid!" : "valid for laser-camera at " + cam.position.chunkPosX + ", " + cam.position.chunkPosY + ", " + cam.position.chunkPosZ)));
return true;
}

View file

@ -2,35 +2,33 @@ package cr0s.warpdrive.machines;
import java.util.Random;
import javax.swing.Icon;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import cr0s.warpdrive.WarpDrive;
public class BlockLift extends BlockContainer
{
private Icon[] iconBuffer;
private IIcon[] iconBuffer;
public BlockLift(int id, int texture, Material material) {
super(id, material);
public BlockLift(int texture, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundMetalFootstep);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
setUnlocalizedName("warpdrive.machines.LaserLift");
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
iconBuffer = new Icon[6];
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");
@ -40,7 +38,7 @@ public class BlockLift extends BlockContainer
}
@Override
public Icon getIcon(int side, int metadata) {
public IIcon getIcon(int side, int metadata) {
if (metadata > 2) {
return iconBuffer[0];
}
@ -58,7 +56,7 @@ public class BlockLift extends BlockContainer
}
@Override
public TileEntity createNewTileEntity(World var1) {
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityLift();
}
@ -74,8 +72,8 @@ public class BlockLift extends BlockContainer
* Returns the ID of the items to drop on destruction.
*/
@Override
public int idDropped(int par1, Random par2Random, int par3) {
return this.blockID;
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
@ -87,9 +85,9 @@ public class BlockLift extends BlockContainer
return false;
}
WarpEnergyTE te = (WarpEnergyTE)par1World.getBlockTileEntity(par2, par3, par4);
WarpEnergyTE te = (WarpEnergyTE)par1World.getTileEntity(par2, par3, par4);
if (te != null && (par5EntityPlayer.getHeldItem() == null)) {
par5EntityPlayer.addChatMessage(te.getStatus());
par5EntityPlayer.addChatMessage(new ChatComponentText(te.getStatus()));
return true;
}

View file

@ -2,21 +2,21 @@ package cr0s.warpdrive.machines;
import java.util.Random;
import javax.swing.Icon;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import cr0s.warpdrive.WarpDrive;
public class BlockMiningLaser extends BlockContainer {
private Icon[] iconBuffer;
private IIcon[] iconBuffer;
private final static int ICON_TOP = 5;
public final static int ICON_IDLE = 0;
public final static int ICON_MININGLOWPOWER = 1;
@ -24,18 +24,16 @@ public class BlockMiningLaser extends BlockContainer {
public final static int ICON_SCANNINGLOWPOWER = 3;
public final static int ICON_SCANNINGPOWERED = 4;
public BlockMiningLaser(int id, int texture, Material material) {
super(id, material);
public BlockMiningLaser(int texture, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundMetalFootstep);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
setUnlocalizedName("warpdrive.machines.MiningLaser");
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
iconBuffer = new Icon[16];
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");
@ -46,7 +44,7 @@ public class BlockMiningLaser extends BlockContainer {
}
@Override
public Icon getIcon(int side, int metadata) {
public IIcon getIcon(int side, int metadata) {
if (side == 0 || side == 1) {
return iconBuffer[ICON_TOP];
}
@ -58,7 +56,7 @@ public class BlockMiningLaser extends BlockContainer {
}
@Override
public TileEntity createNewTileEntity(World var1) {
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityMiningLaser();
}
@ -74,8 +72,8 @@ public class BlockMiningLaser extends BlockContainer {
* Returns the ID of the items to drop on destruction.
*/
@Override
public int idDropped(int par1, Random par2Random, int par3) {
return this.blockID;
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
@ -87,10 +85,10 @@ public class BlockMiningLaser extends BlockContainer {
return false;
}
TileEntityMiningLaser miningLaser = (TileEntityMiningLaser)par1World.getBlockTileEntity(par2, par3, par4);
TileEntityMiningLaser miningLaser = (TileEntityMiningLaser)par1World.getTileEntity(par2, par3, par4);
if (miningLaser != null && (par5EntityPlayer.getHeldItem() == null)) {
par5EntityPlayer.addChatMessage(miningLaser.getStatus());
par5EntityPlayer.addChatMessage(new ChatComponentText(miningLaser.getStatus()));
return true;
}

View file

@ -1,42 +1,39 @@
package cr0s.warpdrive.machines;
import javax.swing.Icon;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.data.CamRegistryItem;
import cr0s.warpdrive.render.ClientCameraUtils;
import cr0s.warpdrive.render.EntityCamera;
public class BlockMonitor extends BlockContainer {
private Icon iconFront;
private Icon iconBlock;
private IIcon iconFront;
private IIcon iconBlock;
public BlockMonitor(int id) {
super(id, Material.iron);
public BlockMonitor() {
super(Material.iron);
setHardness(0.5F);
setStepSound(Block.soundMetalFootstep);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
setUnlocalizedName("warpdrive.machines.Monitor");
}
@Override
@SideOnly(Side.CLIENT)
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
public Icon getIcon(int side, int parMetadata) {
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)));
}
@ -46,7 +43,7 @@ public class BlockMonitor extends BlockContainer {
* is the only chance you get to register icons.
*/
@Override
public void registerIcons(IconRegister reg) {
public void registerBlockIcons(IIconRegister reg) {
this.iconFront = reg.registerIcon("warpdrive:monitorFront");
this.iconBlock = reg.registerIcon("warpdrive:monitorSide");
}
@ -71,23 +68,23 @@ public class BlockMonitor extends BlockContainer {
}
// Get camera frequency
TileEntity te = par1World.getBlockTileEntity(x, y, z);
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(getLocalizedName() + " Frequency '" + frequency + "' is invalid or camera is too far!");
par5EntityPlayer.addChatMessage(new ChatComponentText(getLocalizedName() + " Frequency '" + frequency + "' is invalid or camera is too far!"));
return false;
} else {
par5EntityPlayer.addChatMessage(getLocalizedName() + " Frequency '" + frequency + "' is valid. Viewing camera at " + cam.position.x + ", " + cam.position.y + ", " + cam.position.z);
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.x + 0.5D, cam.position.y + 0.5D, cam.position.z + 0.5D);
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, blockID, cam.position.x, cam.position.y, cam.position.z, par1World.getBlockId(cam.position.x, cam.position.y, cam.position.z));
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));
}
}
@ -95,11 +92,7 @@ public class BlockMonitor extends BlockContainer {
}
@Override
public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) {
}
@Override
public TileEntity createNewTileEntity(World world) {
public TileEntity createNewTileEntity(World world, int i) {
return new TileEntityMonitor();
}
}

View file

@ -2,34 +2,32 @@ package cr0s.warpdrive.machines;
import java.util.Random;
import javax.swing.Icon;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import cr0s.warpdrive.WarpDrive;
public class BlockParticleBooster extends BlockContainer {
private Icon[] iconBuffer;
private IIcon[] iconBuffer;
public BlockParticleBooster(int id, int texture, Material material) {
super(id, material);
public BlockParticleBooster(int texture, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundMetalFootstep);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
setUnlocalizedName("warpdrive.machines.ParticleBooster");
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
iconBuffer = new Icon[16];
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");
@ -45,7 +43,7 @@ public class BlockParticleBooster extends BlockContainer {
}
@Override
public Icon getIcon(int side, int metadata) {
public IIcon getIcon(int side, int metadata) {
if (side == 0 || side == 1) {
return iconBuffer[11];
}
@ -54,7 +52,7 @@ public class BlockParticleBooster extends BlockContainer {
}
@Override
public TileEntity createNewTileEntity(World var1) {
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityParticleBooster();
}
@ -70,8 +68,8 @@ public class BlockParticleBooster extends BlockContainer {
* Returns the ID of the items to drop on destruction.
*/
@Override
public int idDropped(int par1, Random par2Random, int par3) {
return this.blockID;
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
@ -84,9 +82,9 @@ public class BlockParticleBooster extends BlockContainer {
}
if (par5EntityPlayer.getHeldItem() == null) {
TileEntity te = par1World.getBlockTileEntity(par2, par3, par4);
TileEntity te = par1World.getTileEntity(par2, par3, par4);
if (te != null && te instanceof WarpEnergyTE) {
par5EntityPlayer.addChatMessage(((WarpEnergyTE) te).getStatus());
par5EntityPlayer.addChatMessage(new ChatComponentText(((WarpEnergyTE) te).getStatus()));
return true;
}
}

View file

@ -2,13 +2,15 @@ package cr0s.warpdrive.machines;
import java.util.Random;
import javax.swing.Icon;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
@ -16,22 +18,21 @@ import cpw.mods.fml.relauncher.SideOnly;
import cr0s.warpdrive.WarpDrive;
public class BlockProtocol extends BlockContainer {
private Icon[] iconBuffer;
private IIcon[] iconBuffer;
private final int ICON_INACTIVE_SIDE = 0, ICON_BOTTOM = 1, ICON_TOP = 2, ICON_SIDE_ACTIVATED = 3;
public BlockProtocol(int id, int texture, Material material) {
super(id, material);
public BlockProtocol(int id, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundMetalFootstep);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
setUnlocalizedName("warpdrive.machines.WarpProtocol");
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
iconBuffer = new Icon[10];
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");
@ -47,7 +48,7 @@ public class BlockProtocol extends BlockContainer {
}
@Override
public Icon getIcon(int side, int metadata) {
public IIcon getIcon(int side, int metadata) {
if (side == 0) {
return iconBuffer[ICON_BOTTOM];
} else if (side == 1) {
@ -68,7 +69,7 @@ public class BlockProtocol extends BlockContainer {
}
@Override
public TileEntity createNewTileEntity(World var1) {
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityProtocol();
}
@ -84,8 +85,8 @@ public class BlockProtocol extends BlockContainer {
* Returns the ID of the items to drop on destruction.
*/
@Override
public int idDropped(int par1, Random par2Random, int par3) {
return this.blockID;
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
* Called upon block activation (right click on the block.)
@ -97,10 +98,10 @@ public class BlockProtocol extends BlockContainer {
}
if (par5EntityPlayer.getHeldItem() == null) {
TileEntityProtocol controller = (TileEntityProtocol)par1World.getBlockTileEntity(par2, par3, par4);
TileEntityProtocol controller = (TileEntityProtocol)par1World.getTileEntity(par2, par3, par4);
if (controller != null) {
controller.attachPlayer(par5EntityPlayer);
par5EntityPlayer.addChatMessage(controller.getBlockType().getLocalizedName() + " Attached players: " + controller.getAttachedPlayersList());
par5EntityPlayer.addChatMessage(new ChatComponentText(controller.getBlockType().getLocalizedName() + " Attached players: " + controller.getAttachedPlayersList()));
return true;
}
}

View file

@ -2,22 +2,22 @@ package cr0s.warpdrive.machines;
import java.util.Random;
import javax.swing.Icon;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import cr0s.warpdrive.WarpDrive;
public class BlockRadar extends BlockContainer
{
private Icon[] iconBuffer;
private IIcon[] iconBuffer;
private final int ICON_SIDE_INACTIVE = 0;
private final int ICON_BOTTOM = 1;
@ -25,18 +25,16 @@ public class BlockRadar extends BlockContainer
private final int ICON_SIDE_ACTIVATED = 3;
private final int ICON_SIDE_ACTIVATED_SCAN = 4;
public BlockRadar(int id, int texture, Material material) {
super(id, material);
public BlockRadar(int texture, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundMetalFootstep);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
setUnlocalizedName("warpdrive.machines.WarpRadar");
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
iconBuffer = new Icon[16];
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");
@ -45,7 +43,7 @@ public class BlockRadar extends BlockContainer
}
@Override
public Icon getIcon(int side, int metadata) {
public IIcon getIcon(int side, int metadata) {
if (side == 0) {
return iconBuffer[ICON_BOTTOM];
} else if (side == 1) {
@ -64,7 +62,7 @@ public class BlockRadar extends BlockContainer
}
@Override
public TileEntity createNewTileEntity(World var1) {
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityRadar();
}
@ -80,8 +78,8 @@ public class BlockRadar extends BlockContainer
* Returns the ID of the items to drop on destruction.
*/
@Override
public int idDropped(int par1, Random par2Random, int par3) {
return this.blockID;
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
@Override
@ -90,9 +88,9 @@ public class BlockRadar extends BlockContainer
return false;
}
WarpEnergyTE te = (WarpEnergyTE)par1World.getBlockTileEntity(par2, par3, par4);
WarpEnergyTE te = (WarpEnergyTE)par1World.getTileEntity(par2, par3, par4);
if (te != null && (par5EntityPlayer.getHeldItem() == null)) {
par5EntityPlayer.addChatMessage(te.getStatus());
par5EntityPlayer.addChatMessage(new ChatComponentText(te.getStatus()));
return true;
}

View file

@ -2,36 +2,34 @@ package cr0s.warpdrive.machines;
import java.util.Random;
import javax.swing.Icon;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import cr0s.warpdrive.WarpDrive;
public class BlockReactor extends BlockContainer {
private Icon[] 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;
public BlockReactor(int id, int texture, Material material) {
super(id, material);
public BlockReactor(int texture, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundMetalFootstep);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
setUnlocalizedName("warpdrive.machines.WarpCore");
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
iconBuffer = new Icon[5];
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");
@ -40,7 +38,7 @@ public class BlockReactor extends BlockContainer {
}
@Override
public Icon getIcon(int side, int metadata) {
public IIcon getIcon(int side, int metadata) {
if (side == 0) {
return iconBuffer[ICON_BOTTOM];
} else if (side == 1) {
@ -59,7 +57,7 @@ public class BlockReactor extends BlockContainer {
}
@Override
public TileEntity createNewTileEntity(World var1) {
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityReactor();
}
@ -75,8 +73,8 @@ public class BlockReactor extends BlockContainer {
* Returns the ID of the items to drop on destruction.
*/
@Override
public int idDropped(int par1, Random par2Random, int par3) {
return this.blockID;
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
@ -89,9 +87,9 @@ public class BlockReactor extends BlockContainer {
}
if (par5EntityPlayer.getHeldItem() == null) {
TileEntity te = par1World.getBlockTileEntity(par2, par3, par4);
TileEntity te = par1World.getTileEntity(par2, par3, par4);
if (te != null && te instanceof TileEntityReactor) {
par5EntityPlayer.addChatMessage(((TileEntityReactor)te).getStatus());
par5EntityPlayer.addChatMessage(new ChatComponentText(((TileEntityReactor)te).getStatus()));
return true;
}
}
@ -100,8 +98,8 @@ public class BlockReactor extends BlockContainer {
}
@Override
public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) {
TileEntity te = par1World.getBlockTileEntity(par2, par3, par4);
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);
}

View file

@ -7,36 +7,36 @@ import javax.swing.Icon;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import cr0s.warpdrive.WarpDrive;
public class BlockShipScanner extends BlockContainer {
private Icon[] iconBuffer;
private IIcon[] iconBuffer;
public BlockShipScanner(int id, int texture, Material material) {
super(id, material);
public BlockShipScanner(int texture, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundMetalFootstep);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
setUnlocalizedName("warpdrive.machines.Scanner");
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
iconBuffer = new Icon[3];
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 Icon getIcon(int side, int metadata) {
public IIcon getIcon(int side, int metadata) {
if (side == 1) { // UP
return iconBuffer[0];
} else if (side == 0) { // DOWN
@ -47,7 +47,7 @@ public class BlockShipScanner extends BlockContainer {
}
@Override
public TileEntity createNewTileEntity(World var1) {
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityShipScanner();
}
@ -63,8 +63,8 @@ public class BlockShipScanner extends BlockContainer {
* Returns the ID of the items to drop on destruction.
*/
@Override
public int idDropped(int par1, Random par2Random, int par3) {
return this.blockID;
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
@ -76,9 +76,9 @@ public class BlockShipScanner extends BlockContainer {
return false;
}
WarpEnergyTE te = (WarpEnergyTE)par1World.getBlockTileEntity(par2, par3, par4);
WarpEnergyTE te = (WarpEnergyTE)par1World.getTileEntity(par2, par3, par4);
if (te != null && (par5EntityPlayer.getHeldItem() == null)) {
par5EntityPlayer.addChatMessage(te.getStatus());
par5EntityPlayer.addChatMessage(new ChatComponentText(te.getStatus()));
return true;
}

View file

@ -6,30 +6,29 @@ import javax.swing.Icon;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import cr0s.warpdrive.WarpDrive;
public class BlockWarpIsolation extends Block {
private Icon[] iconBuffer;
private IIcon[] iconBuffer;
public BlockWarpIsolation(int id, int texture, Material material) {
super(id, material);
public BlockWarpIsolation(int texture, Material material) {
super(material);
setHardness(0.5F);
setStepSound(Block.soundMetalFootstep);
setStepSound(Block.soundTypeMetal);
setCreativeTab(WarpDrive.warpdriveTab);
setUnlocalizedName("warpdrive.blocks.WarpIsolation");
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
iconBuffer = new Icon[1];
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[1];
iconBuffer[0] = par1IconRegister.registerIcon("warpdrive:warpIsolation");
}
@Override
public Icon getIcon(int side, int metadata) {
public IIcon getIcon(int side, int metadata) {
return iconBuffer[0];
}
@ -45,7 +44,7 @@ public class BlockWarpIsolation extends Block {
* Returns the ID of the items to drop on destruction.
*/
@Override
public int idDropped(int par1, Random par2Random, int par3) {
return this.blockID;
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
}

View file

@ -1,5 +1,6 @@
package cr0s.warpdrive.render;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
@ -7,14 +8,16 @@ import net.minecraft.world.World;
import org.lwjgl.input.Keyboard;
import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.machines.BlockMonitor;
public class ClientCameraUtils {
public static EntityPlayer entityPlayer;
public static int dimensionId = -666;
public static int check1_x, check1_y, check1_z, check1_blockId;
public static int check2_x, check2_y, check2_z, check2_blockId;
public static int check1_x, check1_y, check1_z;
public static Block check1_blockId, check2_blockId;
public static int check2_x, check2_y, check2_z;
public static void setupViewpoint(EntityPlayer parPlayerEntity, EntityCamera entityCamera, int x1, int y1, int z1, int blockId1, int x2, int y2, int z2, int blockId2) {
public static void setupViewpoint(EntityPlayer parPlayerEntity, EntityCamera entityCamera, int x1, int y1, int z1, Block block1, int x2, int y2, int z2, Block block2) {
Minecraft mc = Minecraft.getMinecraft();
if (parPlayerEntity == null) {
@ -31,11 +34,11 @@ public class ClientCameraUtils {
check1_x = x1;
check1_y = y1;
check1_z = z1;
check1_blockId = blockId1;
check1_blockId = block1;
check2_x = x2;
check2_y = y2;
check2_z = z2;
check2_blockId = blockId2;
check2_blockId = block2;
WarpDrive.debugPrint("Setting viewpoint: " + entityCamera.toString());
mc.renderViewEntity = entityCamera;
@ -59,8 +62,12 @@ public class ClientCameraUtils {
WarpDrive.instance.isOverlayEnabled = false;
mc.gameSettings.thirdPersonView = 0;
// TODO: Cannot find 1.7 equivalent
/*
mc.gameSettings.setOptionFloatValue(EnumOptions.FOV, WarpDrive.normalFOV);
mc.gameSettings.setOptionFloatValue(EnumOptions.SENSITIVITY, WarpDrive.normalSensitivity);
*/
entityPlayer = null;
dimensionId = -666;
@ -70,11 +77,11 @@ public class ClientCameraUtils {
if (worldObj == null || worldObj.provider.dimensionId != dimensionId) {
return false;
}
if (worldObj.getBlockId(check1_x, check1_y, check1_z) != check1_blockId) {
if (!worldObj.getBlock(check1_x, check1_y, check1_z).isAssociatedBlock(check1_blockId)) {
WarpDrive.print("[WarpDrive] checking viewpoint, found invalid block1 at (" + check1_x + ", " + check1_y + ", " + check1_z + ")");
return false;
}
if (worldObj.getBlockId(check2_x, check2_y, check2_z) != check2_blockId) {
if (!worldObj.getBlock(check2_x, check2_y, check2_z).isAssociatedBlock(check2_blockId)) {
WarpDrive.print("[WarpDrive] checking viewpoint, found invalid block2 at (" + check2_x + ", " + check2_y + ", " + check2_z + ")");
return false;
}