Fixed blocks registration globally

This commit is contained in:
LemADEC 2015-09-26 04:46:09 +02:00
parent 87d4547230
commit 22fba522f0
23 changed files with 139 additions and 147 deletions

View file

@ -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");
}

View file

@ -9,27 +9,22 @@ 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
/*
@Override
@ -63,9 +58,9 @@ public abstract class BlockAbstractContainer extends BlockContainer {
/**/
@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();
}

View file

@ -18,15 +18,13 @@ 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);
@ -34,8 +32,7 @@ public class BlockAirGenerator extends BlockContainer
}
@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");

View file

@ -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;
@ -9,6 +10,7 @@ public class BlockChunkLoader extends BlockAbstractContainer {
IIcon iconBuffer;
public BlockChunkLoader() {
super(Material.iron);
}
@Override
@ -25,5 +27,4 @@ public class BlockChunkLoader extends BlockAbstractContainer {
public IIcon getIcon(int side, int damage) {
return iconBuffer;
}
}

View file

@ -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);

View file

@ -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);

View file

@ -18,8 +18,8 @@ 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);
@ -70,14 +70,14 @@ public class BlockShipScanner extends BlockContainer {
* 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;
}

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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;
@ -11,7 +12,7 @@ public class BlockEnanReactorCore extends BlockAbstractContainer {
IIcon[] iconBuffer = new IIcon[17];
public BlockEnanReactorCore() {
super();
super(Material.iron);
setBlockName("warpdrive.energy.EnanReactorCore");
}

View file

@ -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;
@ -10,6 +11,7 @@ public class BlockEnanReactorLaser extends BlockAbstractContainer {
static IIcon[] iconBuffer = new IIcon[16];
public BlockEnanReactorLaser() {
super(Material.iron);
setResistance(100.0F);
setBlockName("warpdrive.energy.EnanReactorLaser");
}

View file

@ -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;
@ -14,6 +15,7 @@ public class BlockEnergyBank extends BlockAbstractContainer {
private IIcon iconBuffer;
public BlockEnergyBank() {
super(Material.iron);
setBlockName("warpdrive.energy.EnergyBank");
}
@ -36,14 +38,14 @@ public class BlockEnergyBank extends BlockAbstractContainer {
* 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;
}

View file

@ -11,21 +11,16 @@ 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");
}

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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");
}

View file

@ -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);