Fixed blocks registration globally
This commit is contained in:
parent
87d4547230
commit
22fba522f0
23 changed files with 139 additions and 147 deletions
|
@ -3,7 +3,6 @@ package cr0s.warpdrive;
|
|||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
|
@ -201,30 +200,30 @@ public class WarpDrive implements LoadingCallback {
|
|||
WarpDriveConfig.onFMLInitialization();
|
||||
|
||||
// CORE CONTROLLER
|
||||
blockShipController = new BlockShipController(0, Material.rock);
|
||||
blockShipController = new BlockShipController();
|
||||
|
||||
GameRegistry.registerBlock(blockShipController, "blockShipController");
|
||||
GameRegistry.registerTileEntity(TileEntityShipController.class, MODID + ":blockShipController");
|
||||
|
||||
// WARP CORE
|
||||
blockShipCore = new BlockShipCore(0, Material.rock);
|
||||
blockShipCore = new BlockShipCore();
|
||||
|
||||
GameRegistry.registerBlock(blockShipCore, "blockShipCore");
|
||||
GameRegistry.registerTileEntity(TileEntityShipCore.class, MODID + ":blockShipCore");
|
||||
|
||||
// WARP RADAR
|
||||
blockRadar = new BlockRadar(0, Material.rock);
|
||||
blockRadar = new BlockRadar();
|
||||
|
||||
GameRegistry.registerBlock(blockRadar, "blockRadar");
|
||||
GameRegistry.registerTileEntity(TileEntityRadar.class, MODID + ":blockRadar");
|
||||
|
||||
// WARP ISOLATION
|
||||
blockWarpIsolation = new BlockWarpIsolation(0, Material.rock);
|
||||
blockWarpIsolation = new BlockWarpIsolation();
|
||||
|
||||
GameRegistry.registerBlock(blockWarpIsolation, "blockWarpIsolation");
|
||||
|
||||
// AIR GENERATOR
|
||||
blockAirGenerator = new BlockAirGenerator(0, Material.rock);
|
||||
blockAirGenerator = new BlockAirGenerator();
|
||||
|
||||
GameRegistry.registerBlock(blockAirGenerator, "blockAirGenerator");
|
||||
GameRegistry.registerTileEntity(TileEntityAirGenerator.class, MODID + ":blockAirGenerator");
|
||||
|
@ -240,18 +239,18 @@ public class WarpDrive implements LoadingCallback {
|
|||
GameRegistry.registerBlock(blockGas, "blockGas");
|
||||
|
||||
// LASER EMITTER
|
||||
blockLaser = new BlockLaser(0, Material.rock);
|
||||
blockLaser = new BlockLaser();
|
||||
|
||||
GameRegistry.registerBlock(blockLaser, "blockLaser");
|
||||
GameRegistry.registerTileEntity(TileEntityLaser.class, MODID + ":blockLaser");
|
||||
|
||||
// LASER EMITTER WITH CAMERA
|
||||
blockLaserCamera = new BlockLaserCamera(0, Material.rock);
|
||||
blockLaserCamera = new BlockLaserCamera();
|
||||
|
||||
GameRegistry.registerBlock(blockLaserCamera, "blockLaserCamera");
|
||||
|
||||
// CAMERA
|
||||
blockCamera = new BlockCamera(0, Material.rock);
|
||||
blockCamera = new BlockCamera();
|
||||
|
||||
GameRegistry.registerBlock(blockCamera, "blockCamera");
|
||||
GameRegistry.registerTileEntity(TileEntityCamera.class, MODID + ":blockCamera");
|
||||
|
@ -263,25 +262,25 @@ public class WarpDrive implements LoadingCallback {
|
|||
GameRegistry.registerTileEntity(TileEntityMonitor.class, MODID + ":blockMonitor");
|
||||
|
||||
// MINING LASER
|
||||
blockMiningLaser = new BlockMiningLaser(0, Material.rock);
|
||||
blockMiningLaser = new BlockMiningLaser();
|
||||
|
||||
GameRegistry.registerBlock(blockMiningLaser, "blockMiningLaser");
|
||||
GameRegistry.registerTileEntity(TileEntityMiningLaser.class, MODID + ":blockMiningLaser");
|
||||
|
||||
// LASER TREE FARM
|
||||
blockLaserTreeFarm = new BlockLaserTreeFarm(0, Material.rock);
|
||||
blockLaserTreeFarm = new BlockLaserTreeFarm();
|
||||
|
||||
GameRegistry.registerBlock(blockLaserTreeFarm, "blockLaserTreeFarm");
|
||||
GameRegistry.registerTileEntity(TileEntityLaserTreeFarm.class, MODID + ":blockLaserTreeFarm");
|
||||
|
||||
// LASER MEDIUM
|
||||
blockLaserMedium = new BlockLaserMedium(0, Material.rock);
|
||||
blockLaserMedium = new BlockLaserMedium();
|
||||
|
||||
GameRegistry.registerBlock(blockLaserMedium, "blockLaserMedium");
|
||||
GameRegistry.registerTileEntity(TileEntityLaserMedium.class, MODID + ":blockLaserMedium");
|
||||
|
||||
// LIFT
|
||||
blockLift = new BlockLift(0, Material.rock);
|
||||
blockLift = new BlockLift();
|
||||
|
||||
GameRegistry.registerBlock(blockLift, "blockLift");
|
||||
GameRegistry.registerTileEntity(TileEntityLift.class, MODID + ":blockLift");
|
||||
|
@ -299,31 +298,31 @@ public class WarpDrive implements LoadingCallback {
|
|||
}
|
||||
|
||||
// SHIP SCANNER
|
||||
blockShipScanner = new BlockShipScanner(0, Material.rock);
|
||||
blockShipScanner = new BlockShipScanner();
|
||||
|
||||
GameRegistry.registerBlock(blockShipScanner, "blockShipScanner");
|
||||
GameRegistry.registerTileEntity(TileEntityShipScanner.class, MODID + ":blockShipScanner");
|
||||
|
||||
// CLOAKING DEVICE CORE
|
||||
blockCloakingCore = new BlockCloakingCore(0, Material.rock);
|
||||
blockCloakingCore = new BlockCloakingCore();
|
||||
|
||||
GameRegistry.registerBlock(blockCloakingCore, "blockCloakingCore");
|
||||
GameRegistry.registerTileEntity(TileEntityCloakingCore.class, MODID + ":blockCloakingCore");
|
||||
|
||||
// CLOAKING DEVICE COIL
|
||||
blockCloakingCoil = new BlockCloakingCoil(0, Material.rock);
|
||||
blockCloakingCoil = new BlockCloakingCoil();
|
||||
|
||||
GameRegistry.registerBlock(blockCloakingCoil, "blockCloakingCoil");
|
||||
|
||||
// TRANSPORTER
|
||||
blockTransporter = new BlockTransporter(Material.rock);
|
||||
blockTransporter = new BlockTransporter();
|
||||
|
||||
GameRegistry.registerBlock(blockTransporter, "blockTransporter");
|
||||
GameRegistry.registerTileEntity(TileEntityTransporter.class, MODID + ":blockTransporter");
|
||||
|
||||
// IC2 REACTOR LASER MONITOR
|
||||
if (WarpDriveConfig.isIndustrialCraft2loaded) {
|
||||
blockIC2reactorLaserMonitor = new BlockIC2reactorLaserMonitor(Material.rock);
|
||||
blockIC2reactorLaserMonitor = new BlockIC2reactorLaserMonitor();
|
||||
|
||||
GameRegistry.registerBlock(blockIC2reactorLaserMonitor, "blockIC2reactorLaserMonitor");
|
||||
GameRegistry.registerTileEntity(TileEntityIC2reactorLaserMonitor.class, MODID + ":blockIC2reactorLaserMonitor");
|
||||
|
@ -445,12 +444,12 @@ public class WarpDrive implements LoadingCallback {
|
|||
public Ticket registerChunkLoadTE(TileEntityAbstractChunkLoading tileEntity, boolean refreshLoading) {
|
||||
World worldObj = tileEntity.getWorldObj();
|
||||
if (ForgeChunkManager.ticketCountAvailableFor(this, worldObj) > 0) {
|
||||
Ticket t = ForgeChunkManager.requestTicket(this, worldObj, Type.NORMAL);
|
||||
if (t != null) {
|
||||
tileEntity.giveTicket(t); // FIXME calling the caller is a bad idea
|
||||
Ticket ticket = ForgeChunkManager.requestTicket(this, worldObj, Type.NORMAL);
|
||||
if (ticket != null) {
|
||||
tileEntity.giveTicket(ticket); // FIXME calling the caller is a bad idea
|
||||
if (refreshLoading)
|
||||
tileEntity.refreshLoading();
|
||||
return t;
|
||||
return ticket;
|
||||
} else {
|
||||
WarpDrive.logger.error("Ticket not granted");
|
||||
}
|
||||
|
|
|
@ -9,26 +9,21 @@ import cr0s.warpdrive.WarpDrive;
|
|||
import cr0s.warpdrive.api.IBlockUpdateDetector;
|
||||
|
||||
public abstract class BlockAbstractContainer extends BlockContainer {
|
||||
protected BlockAbstractContainer() {
|
||||
super(Material.iron);
|
||||
}
|
||||
|
||||
protected BlockAbstractContainer(Material m) {
|
||||
super(m);
|
||||
protected BlockAbstractContainer(Material material) {
|
||||
super(material);
|
||||
setHardness(0.5F);
|
||||
setStepSound(Block.soundTypeMetal);
|
||||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World w, int x, int y, int z) {
|
||||
super.onBlockAdded(w, x, y, z);
|
||||
TileEntity tileEntity = w.getTileEntity(x, y, z);
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof IBlockUpdateDetector) {
|
||||
((IBlockUpdateDetector) tileEntity).updatedNeighbours();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// FIXME untested
|
||||
/*
|
||||
|
@ -37,7 +32,7 @@ public abstract class BlockAbstractContainer extends BlockContainer {
|
|||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
boolean hasResponse = false;
|
||||
TileEntity te = world.getBlockTileEntity(x, y, z);
|
||||
if (te != null && te instanceof IUpgradable) {
|
||||
|
@ -57,15 +52,15 @@ public abstract class BlockAbstractContainer extends BlockContainer {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return hasResponse;
|
||||
}
|
||||
/**/
|
||||
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World w, int x, int y, int z, Block b) {
|
||||
super.onNeighborBlockChange(w, x, y, z, b);
|
||||
TileEntity tileEntity = w.getTileEntity(x, y, z);
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||
super.onNeighborBlockChange(world, x, y, z, block);
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof IBlockUpdateDetector) {
|
||||
((IBlockUpdateDetector) tileEntity).updatedNeighbours();
|
||||
}
|
||||
|
|
|
@ -18,30 +18,27 @@ import cr0s.warpdrive.WarpDrive;
|
|||
import cr0s.warpdrive.api.IAirCanister;
|
||||
import cr0s.warpdrive.config.WarpDriveConfig;
|
||||
|
||||
public class BlockAirGenerator extends BlockContainer
|
||||
{
|
||||
public class BlockAirGenerator extends BlockContainer {
|
||||
private IIcon[] iconBuffer;
|
||||
|
||||
|
||||
private final int ICON_INACTIVE_SIDE = 0, ICON_BOTTOM = 1, ICON_SIDE_ACTIVATED = 2;
|
||||
|
||||
public BlockAirGenerator(int texture, Material material)
|
||||
{
|
||||
super(material);
|
||||
|
||||
public BlockAirGenerator() {
|
||||
super(Material.rock);
|
||||
setHardness(0.5F);
|
||||
setStepSound(Block.soundTypeMetal);
|
||||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
setBlockName("warpdrive.machines.AirGenerator");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
iconBuffer = new IIcon[3];
|
||||
iconBuffer[ICON_INACTIVE_SIDE] = par1IconRegister.registerIcon("warpdrive:airGeneratorSideInactive");
|
||||
iconBuffer[ICON_BOTTOM] = par1IconRegister.registerIcon("warpdrive:airGeneratorBottom");
|
||||
iconBuffer[ICON_SIDE_ACTIVATED] = par1IconRegister.registerIcon("warpdrive:airGeneratorSideActive");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
if (side == 0) {
|
||||
|
@ -53,21 +50,21 @@ public class BlockAirGenerator extends BlockContainer
|
|||
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;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int i) {
|
||||
return new TileEntityAirGenerator();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
|
@ -75,7 +72,7 @@ public class BlockAirGenerator extends BlockContainer
|
|||
public int quantityDropped(Random par1Random) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the ID of the items to drop on destruction.
|
||||
*/
|
||||
|
@ -83,14 +80,14 @@ public class BlockAirGenerator extends BlockContainer
|
|||
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;
|
||||
}
|
||||
|
||||
TileEntityAbstractEnergy te = (TileEntityAbstractEnergy)par1World.getTileEntity(par2, par3, par4);
|
||||
|
||||
TileEntityAbstractEnergy te = (TileEntityAbstractEnergy) par1World.getTileEntity(par2, par3, par4);
|
||||
if (te != null) {
|
||||
ItemStack heldItemStack = player.getHeldItem();
|
||||
if (heldItemStack == null) {
|
||||
|
@ -99,7 +96,7 @@ public class BlockAirGenerator extends BlockContainer
|
|||
} else {
|
||||
Item heldItem = heldItemStack.getItem();
|
||||
if (heldItem != null && (heldItem instanceof IAirCanister)) {
|
||||
IAirCanister airCanister = (IAirCanister)heldItem;
|
||||
IAirCanister airCanister = (IAirCanister) heldItem;
|
||||
if (airCanister.canContainAir(heldItemStack) && te.consumeEnergy(WarpDriveConfig.AIRGEN_ENERGY_PER_CANISTER, true)) {
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
ItemStack toAdd = airCanister.fullDrop(heldItemStack);
|
||||
|
@ -114,7 +111,7 @@ public class BlockAirGenerator extends BlockContainer
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cr0s.warpdrive.block;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
@ -7,23 +8,23 @@ import net.minecraft.world.World;
|
|||
|
||||
public class BlockChunkLoader extends BlockAbstractContainer {
|
||||
IIcon iconBuffer;
|
||||
|
||||
|
||||
public BlockChunkLoader() {
|
||||
super(Material.iron);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
return new TileEntityChunkLoader();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister ir) {
|
||||
iconBuffer = ir.registerIcon("warpdrive:chunkLoader");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int damage) {
|
||||
return iconBuffer;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@ public class BlockLaser extends BlockContainer {
|
|||
|
||||
private final int ICON_SIDE = 0;
|
||||
|
||||
public BlockLaser(int texture, Material material) {
|
||||
super(material);
|
||||
public BlockLaser() {
|
||||
super(Material.rock);
|
||||
setHardness(0.5F);
|
||||
setStepSound(Block.soundTypeMetal);
|
||||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
|
|
|
@ -17,8 +17,8 @@ import cr0s.warpdrive.WarpDrive;
|
|||
public class BlockLaserMedium extends BlockContainer {
|
||||
private IIcon[] iconBuffer;
|
||||
|
||||
public BlockLaserMedium(int texture, Material material) {
|
||||
super(material);
|
||||
public BlockLaserMedium() {
|
||||
super(Material.rock);
|
||||
setHardness(0.5F);
|
||||
setStepSound(Block.soundTypeMetal);
|
||||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
|
|
|
@ -17,15 +17,15 @@ import cr0s.warpdrive.block.TileEntityAbstractEnergy;
|
|||
|
||||
public class BlockShipScanner extends BlockContainer {
|
||||
private IIcon[] iconBuffer;
|
||||
|
||||
public BlockShipScanner(int texture, Material material) {
|
||||
super(material);
|
||||
|
||||
public BlockShipScanner() {
|
||||
super(Material.rock);
|
||||
setHardness(0.5F);
|
||||
setStepSound(Block.soundTypeMetal);
|
||||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
setBlockName("warpdrive.building.ShipScanner");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
iconBuffer = new IIcon[3];
|
||||
|
@ -33,7 +33,7 @@ public class BlockShipScanner extends BlockContainer {
|
|||
iconBuffer[1] = par1IconRegister.registerIcon("warpdrive:building/shipScannerSide");
|
||||
iconBuffer[2] = par1IconRegister.registerIcon("warpdrive:building/shipScannerBottom");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
if (side == 1) { // UP
|
||||
|
@ -41,15 +41,15 @@ public class BlockShipScanner extends BlockContainer {
|
|||
} else if (side == 0) { // DOWN
|
||||
return iconBuffer[2];
|
||||
}
|
||||
|
||||
|
||||
return iconBuffer[1];
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int i) {
|
||||
return new TileEntityShipScanner();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
|
@ -57,7 +57,7 @@ public class BlockShipScanner extends BlockContainer {
|
|||
public int quantityDropped(Random par1Random) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the ID of the items to drop on destruction.
|
||||
*/
|
||||
|
@ -65,22 +65,22 @@ public class BlockShipScanner extends BlockContainer {
|
|||
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) {
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntityAbstractEnergy te = (TileEntityAbstractEnergy)par1World.getTileEntity(par2, par3, par4);
|
||||
if (te != null && (par5EntityPlayer.getHeldItem() == null)) {
|
||||
WarpDrive.addChatMessage(par5EntityPlayer, te.getStatus());
|
||||
|
||||
TileEntityAbstractEnergy te = (TileEntityAbstractEnergy)world.getTileEntity(x, y, z);
|
||||
if (te != null && (entityPlayer.getHeldItem() == null)) {
|
||||
WarpDrive.addChatMessage(entityPlayer, te.getStatus());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -15,8 +15,8 @@ import cr0s.warpdrive.WarpDrive;
|
|||
public class BlockLaserTreeFarm extends BlockContainer {
|
||||
private IIcon[] iconBuffer;
|
||||
|
||||
public BlockLaserTreeFarm(int texture, Material material) {
|
||||
super(material);
|
||||
public BlockLaserTreeFarm() {
|
||||
super(Material.rock);
|
||||
setHardness(0.5F);
|
||||
setStepSound(Block.soundTypeMetal);
|
||||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
|
|
|
@ -23,8 +23,8 @@ public class BlockMiningLaser extends BlockContainer {
|
|||
public final static int ICON_SCANNINGLOWPOWER = 3;
|
||||
public final static int ICON_SCANNINGPOWERED = 4;
|
||||
|
||||
public BlockMiningLaser(int texture, Material material) {
|
||||
super(material);
|
||||
public BlockMiningLaser() {
|
||||
super(Material.rock);
|
||||
setHardness(0.5F);
|
||||
setStepSound(Block.soundTypeMetal);
|
||||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
|
|
|
@ -20,8 +20,8 @@ public class BlockCamera extends BlockContainer {
|
|||
|
||||
private final int ICON_SIDE = 0;
|
||||
|
||||
public BlockCamera(int texture, Material material) {
|
||||
super(material);
|
||||
public BlockCamera() {
|
||||
super(Material.rock);
|
||||
setHardness(0.5F);
|
||||
setStepSound(Block.soundTypeMetal);
|
||||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
|
|
|
@ -13,8 +13,8 @@ import cr0s.warpdrive.WarpDrive;
|
|||
public class BlockCloakingCoil extends Block {
|
||||
private IIcon[] iconBuffer;
|
||||
|
||||
public BlockCloakingCoil(int texture, Material material) {
|
||||
super(material);
|
||||
public BlockCloakingCoil() {
|
||||
super(Material.rock);
|
||||
setHardness(0.5F);
|
||||
setStepSound(Block.soundTypeMetal);
|
||||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
|
|
|
@ -17,8 +17,8 @@ import cr0s.warpdrive.WarpDrive;
|
|||
public class BlockCloakingCore extends BlockContainer {
|
||||
private IIcon[] iconBuffer;
|
||||
|
||||
public BlockCloakingCore(int texture, Material material) {
|
||||
super(material);
|
||||
public BlockCloakingCore() {
|
||||
super(Material.rock);
|
||||
setHardness(0.5F);
|
||||
setStepSound(Block.soundTypeMetal);
|
||||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
|
|
|
@ -25,8 +25,8 @@ public class BlockRadar extends BlockContainer
|
|||
private final int ICON_SIDE_ACTIVATED = 3;
|
||||
private final int ICON_SIDE_ACTIVATED_SCAN = 4;
|
||||
|
||||
public BlockRadar(int texture, Material material) {
|
||||
super(material);
|
||||
public BlockRadar() {
|
||||
super(Material.rock);
|
||||
setHardness(0.5F);
|
||||
setStepSound(Block.soundTypeMetal);
|
||||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
|
|
|
@ -12,8 +12,8 @@ import cr0s.warpdrive.WarpDrive;
|
|||
public class BlockWarpIsolation extends Block {
|
||||
private IIcon[] iconBuffer;
|
||||
|
||||
public BlockWarpIsolation(int texture, Material material) {
|
||||
super(material);
|
||||
public BlockWarpIsolation() {
|
||||
super(Material.rock);
|
||||
setHardness(0.5F);
|
||||
setStepSound(Block.soundTypeMetal);
|
||||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
|
|
|
@ -2,6 +2,7 @@ package cr0s.warpdrive.block.energy;
|
|||
|
||||
import cr0s.warpdrive.block.BlockAbstractContainer;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
@ -9,21 +10,21 @@ import net.minecraft.world.World;
|
|||
|
||||
public class BlockEnanReactorCore extends BlockAbstractContainer {
|
||||
IIcon[] iconBuffer = new IIcon[17];
|
||||
|
||||
|
||||
public BlockEnanReactorCore() {
|
||||
super();
|
||||
super(Material.iron);
|
||||
setBlockName("warpdrive.energy.EnanReactorCore");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
return new TileEntityEnanReactorCore();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void breakBlock(World w, int x, int y, int z, Block oid, int om) {
|
||||
super.breakBlock(w, x, y, z, oid, om);
|
||||
|
||||
|
||||
int[] xo = { -2, 2, 0, 0 };
|
||||
int[] zo = { 0, 0, -2, 2 };
|
||||
for (int i = 0; i < 4; i++) {
|
||||
|
@ -33,7 +34,7 @@ public class BlockEnanReactorCore extends BlockAbstractContainer {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
if (side == 0 || side == 1) {
|
||||
|
@ -44,7 +45,7 @@ public class BlockEnanReactorCore extends BlockAbstractContainer {
|
|||
}
|
||||
return iconBuffer[0];
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
iconBuffer[16] = par1IconRegister.registerIcon("warpdrive:energy/enanReactorCoreTopBottom");
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package cr0s.warpdrive.block.energy;
|
||||
|
||||
import cr0s.warpdrive.block.BlockAbstractContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
@ -8,49 +9,50 @@ import net.minecraft.world.World;
|
|||
|
||||
public class BlockEnanReactorLaser extends BlockAbstractContainer {
|
||||
static IIcon[] iconBuffer = new IIcon[16];
|
||||
|
||||
|
||||
public BlockEnanReactorLaser() {
|
||||
super(Material.iron);
|
||||
setResistance(100.0F);
|
||||
setBlockName("warpdrive.energy.EnanReactorLaser");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
return new TileEntityEnanReactorLaser();
|
||||
}
|
||||
|
||||
|
||||
private static boolean isActive(int side, int meta) {
|
||||
if (side == 3 && meta == 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (side == 2 && meta == 2) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (side == 4 && meta == 4) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (side == 5 && meta == 3) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
if (side == 0 || side == 1) {
|
||||
return iconBuffer[0];
|
||||
}
|
||||
|
||||
|
||||
if (isActive(side, meta)) {
|
||||
return iconBuffer[2];
|
||||
}
|
||||
|
||||
|
||||
return iconBuffer[1];
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
iconBuffer[0] = par1IconRegister.registerIcon("warpdrive:energy/enanReactorLaserTopBottom");
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cr0s.warpdrive.block.energy;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -12,41 +13,42 @@ import cr0s.warpdrive.block.TileEntityAbstractEnergy;
|
|||
|
||||
public class BlockEnergyBank extends BlockAbstractContainer {
|
||||
private IIcon iconBuffer;
|
||||
|
||||
|
||||
public BlockEnergyBank() {
|
||||
super(Material.iron);
|
||||
setBlockName("warpdrive.energy.EnergyBank");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
return new TileEntityEnergyBank();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return iconBuffer;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
iconBuffer = par1IconRegister.registerIcon("warpdrive:energy/energyBank");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntityAbstractEnergy te = (TileEntityAbstractEnergy) par1World.getTileEntity(par2, par3, par4);
|
||||
if (te != null && (par5EntityPlayer.getHeldItem() == null)) {
|
||||
WarpDrive.addChatMessage(par5EntityPlayer, te.getStatus());
|
||||
|
||||
TileEntityAbstractEnergy tileEntity = (TileEntityAbstractEnergy) world.getTileEntity(x, y, z);
|
||||
if (tileEntity != null && (entityPlayer.getHeldItem() == null)) {
|
||||
WarpDrive.addChatMessage(entityPlayer, tileEntity.getStatus());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -11,29 +11,24 @@ import net.minecraft.world.World;
|
|||
import cr0s.warpdrive.WarpDrive;
|
||||
|
||||
public class BlockIC2reactorLaserMonitor extends BlockContainer {
|
||||
public BlockIC2reactorLaserMonitor(int texture, Material material) {
|
||||
super(material);
|
||||
public BlockIC2reactorLaserMonitor() {
|
||||
super(Material.rock);
|
||||
setHardness(0.5F);
|
||||
setStepSound(Block.soundTypeMetal);
|
||||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
this.setBlockName("warpdrive.energy.IC2ReactorLaserMonitor");
|
||||
}
|
||||
|
||||
public BlockIC2reactorLaserMonitor(Material material) {
|
||||
this(0, material);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
// Solid textures
|
||||
blockIcon = par1IconRegister.registerIcon("warpdrive:energy/IC2reactorLaserMonitor");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int i) {
|
||||
return new TileEntityIC2reactorLaserMonitor();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called upon block activation (right click on the block.)
|
||||
*/
|
||||
|
|
|
@ -19,8 +19,8 @@ public class BlockLift extends BlockContainer
|
|||
{
|
||||
private IIcon[] iconBuffer;
|
||||
|
||||
public BlockLift(int texture, Material material) {
|
||||
super(material);
|
||||
public BlockLift() {
|
||||
super(Material.rock);
|
||||
setHardness(0.5F);
|
||||
setStepSound(Block.soundTypeMetal);
|
||||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
|
|
|
@ -21,8 +21,8 @@ public class BlockShipController extends BlockContainer {
|
|||
|
||||
private final int ICON_INACTIVE_SIDE = 0, ICON_BOTTOM = 1, ICON_TOP = 2, ICON_SIDE_ACTIVATED = 3;
|
||||
|
||||
public BlockShipController(int id, Material material) {
|
||||
super(material);
|
||||
public BlockShipController() {
|
||||
super(Material.rock);
|
||||
setHardness(0.5F);
|
||||
setStepSound(Block.soundTypeMetal);
|
||||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
|
|
|
@ -19,8 +19,8 @@ public class BlockShipCore extends BlockContainer {
|
|||
|
||||
private final int ICON_SIDE_INACTIVE = 0, ICON_BOTTOM = 1, ICON_TOP = 2, ICON_SIDE_ACTIVATED = 3, ICON_SIDE_HEATED = 4;
|
||||
|
||||
public BlockShipCore(int texture, Material material) {
|
||||
super(material);
|
||||
public BlockShipCore() {
|
||||
super(Material.rock);
|
||||
setHardness(0.5F);
|
||||
setStepSound(Block.soundTypeMetal);
|
||||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
|
|
|
@ -11,8 +11,8 @@ public class BlockTransporter extends BlockAbstractContainer {
|
|||
|
||||
private IIcon[] iconBuffer;
|
||||
|
||||
public BlockTransporter(Material par2Material) {
|
||||
super(par2Material);
|
||||
public BlockTransporter() {
|
||||
super(Material.rock);
|
||||
setBlockName("warpdrive.movement.Transporter");
|
||||
}
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ public class BlockLaserCamera extends BlockContainer {
|
|||
|
||||
private final int ICON_SIDE = 0;
|
||||
|
||||
public BlockLaserCamera(int texture, Material material) {
|
||||
super(material);
|
||||
public BlockLaserCamera() {
|
||||
super(Material.rock);
|
||||
setHardness(0.5F);
|
||||
setStepSound(Block.soundTypeMetal);
|
||||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
|
|
Loading…
Reference in a new issue