
I redone where the items/blocsks are stored and how the configs are handled to clean up it and give space. You can change the config line to AWWayofTime if you want to keep the compatibility with old configs. Now you reference the blocks from the ModBlocks and Items from the ModItems.
104 lines
2.5 KiB
Java
104 lines
2.5 KiB
Java
package WayofTime.alchemicalWizardry.common.block;
|
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.block.material.Material;
|
|
import net.minecraft.client.renderer.texture.IconRegister;
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.item.ItemBlock;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.world.World;
|
|
|
|
import java.util.Random;
|
|
|
|
public class SpectralBlock extends Block {
|
|
public SpectralBlock(int par1)
|
|
{
|
|
super(par1, Material.rock);
|
|
this.setUnlocalizedName("spectralBlock");
|
|
}
|
|
|
|
// @Override
|
|
// public int tickRate(World par1World)
|
|
// {
|
|
// return 10;
|
|
// }
|
|
|
|
/**
|
|
* Ticks the block if it's been scheduled
|
|
*/
|
|
@Override
|
|
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
|
|
{
|
|
//if(!par1World.isRemote)
|
|
par1World.setBlockToAir(par2, par3, par4);
|
|
}
|
|
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
public void registerIcons(IconRegister iconRegister)
|
|
{
|
|
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:SpectralBlock");
|
|
}
|
|
|
|
@Override
|
|
public boolean isOpaqueCube()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public int quantityDropped(Random par1Random)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
/**
|
|
* Returns which pass should this block be rendered on. 0 for solids and 1 for alpha
|
|
*/
|
|
public int getRenderBlockPass()
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
@Override
|
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
|
{
|
|
//TEAltar tileEntity = (TEAltar)world.getBlockTileEntity(x, y, z);
|
|
if (player.isSneaking())
|
|
{
|
|
return false;
|
|
}
|
|
|
|
ItemStack playerItem = player.getCurrentEquippedItem();
|
|
|
|
if (playerItem != null)
|
|
{
|
|
if (playerItem.getItem() instanceof ItemBlock)
|
|
{
|
|
world.setBlock(x, y, z, playerItem.itemID, playerItem.getItemDamage(), 3);
|
|
|
|
if (!player.capabilities.isCreativeMode)
|
|
{
|
|
playerItem.stackSize--;
|
|
}
|
|
|
|
return true;
|
|
} else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public void onBlockAdded(World par1World, int par2, int par3, int par4)
|
|
{
|
|
par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, 100);
|
|
}
|
|
}
|