Joshie comment!
This commit is contained in:
parent
1c0deadfc6
commit
ac943e9d38
753 changed files with 8715 additions and 1184 deletions
|
@ -0,0 +1,336 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
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.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
|
||||
import WayofTime.alchemicalWizardry.common.ArmourComponent;
|
||||
import WayofTime.alchemicalWizardry.common.items.BoundArmour;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESocket;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ArmourForge extends Block
|
||||
{
|
||||
public static List<ArmourComponent> helmetList = new ArrayList();
|
||||
public static List<ArmourComponent> plateList = new ArrayList();
|
||||
public static List<ArmourComponent> leggingsList = new ArrayList();
|
||||
public static List<ArmourComponent> bootsList = new ArrayList();
|
||||
|
||||
public ArmourForge()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("armourForge");
|
||||
//setUnlocalizedName("armourForge");
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:SoulForge");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int armourType = getArmourType(world, x, y, z);
|
||||
|
||||
if (armourType == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int direction = getDirectionForArmourType(world, x, y, z, armourType);
|
||||
|
||||
if (!isParadigmValid(armourType, direction, world, x, y, z))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
List<ArmourComponent> list = null;
|
||||
ItemStack armourPiece = null;
|
||||
|
||||
switch (armourType)
|
||||
{
|
||||
case 0:
|
||||
list = plateList;
|
||||
armourPiece = new ItemStack(ModItems.boundPlate, 1, 0);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
list = leggingsList;
|
||||
armourPiece = new ItemStack(ModItems.boundLeggings, 1, 0);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
list = helmetList;
|
||||
armourPiece = new ItemStack(ModItems.boundHelmet, 1, 0);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
list = bootsList;
|
||||
armourPiece = new ItemStack(ModItems.boundBoots, 1, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
if (list == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (armourPiece == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (armourPiece.stackTagCompound == null)
|
||||
{
|
||||
armourPiece.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
for (ArmourComponent ac : list)
|
||||
{
|
||||
int xOff = ac.getXOff();
|
||||
int zOff = ac.getZOff();
|
||||
TileEntity tileEntity;
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case 1:
|
||||
tileEntity = world.getTileEntity(x + xOff, y, z - zOff);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
tileEntity = world.getTileEntity(x + zOff, y, z + xOff);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
tileEntity = world.getTileEntity(x - xOff, y, z + zOff);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
tileEntity = world.getTileEntity(x - zOff, y, z - xOff);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
tileEntity = world.getTileEntity(x + xOff, y + zOff, z);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
tileEntity = world.getTileEntity(x, y + zOff, z + xOff);
|
||||
break;
|
||||
|
||||
default:
|
||||
tileEntity = null;
|
||||
}
|
||||
|
||||
if (tileEntity instanceof TESocket)
|
||||
{
|
||||
ItemStack itemStack = ((TESocket) tileEntity).getStackInSlot(0);
|
||||
int xCoord = tileEntity.xCoord;
|
||||
int yCoord = tileEntity.yCoord;
|
||||
int zCoord = tileEntity.zCoord;
|
||||
((TESocket) tileEntity).setInventorySlotContents(0, null);
|
||||
world.setBlockToAir(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
//PacketDispatcher.sendPacketToAllAround(xCoord, yCoord, zCoord, 20, world.provider.dimensionId, TEAltar.getParticlePacket(xCoord, yCoord, zCoord, (short) 1));
|
||||
SpellHelper.sendIndexedParticleToAllAround(world, xCoord, yCoord, zCoord, 20, world.provider.dimensionId, 1, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
if (itemStack != null)
|
||||
{
|
||||
Item item = itemStack.getItem();
|
||||
|
||||
if (item instanceof ArmourUpgrade)
|
||||
{
|
||||
((BoundArmour) armourPiece.getItem()).hasAddedToInventory(armourPiece, itemStack.copy());
|
||||
((TESocket) tileEntity).setInventorySlotContents(0, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (armourPiece != null)
|
||||
{
|
||||
int xOff = (world.rand.nextInt(11) - 5);
|
||||
int zOff = (int) (Math.sqrt(25 - xOff * xOff) * (world.rand.nextInt(2) - 0.5) * 2);
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x + xOff, y + 5, z + zOff));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y + 1, z, armourPiece));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//0 for plate, 1 for leggings, 2 for helmet, 3 for boots
|
||||
public int getArmourType(World world, int x, int y, int z)
|
||||
{
|
||||
for (int i = 0; i <= 3; i++)
|
||||
{
|
||||
if (getDirectionForArmourType(world, x, y, z, i) != -1)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int getDirectionForArmourType(World world, int x, int y, int z, int armourType)
|
||||
{
|
||||
for (int i = 1; i <= 6; i++)
|
||||
{
|
||||
if (isParadigmValid(armourType, i, world, x, y, z))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public boolean isParadigmValid(int armourType, int direction, World world, int x, int y, int z)
|
||||
{
|
||||
List<ArmourComponent> list = null;
|
||||
|
||||
switch (armourType)
|
||||
{
|
||||
case 0:
|
||||
list = plateList;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
list = leggingsList;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
list = helmetList;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
list = bootsList;
|
||||
break;
|
||||
}
|
||||
|
||||
if (list == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (ArmourComponent ac : list)
|
||||
{
|
||||
int xOff = ac.getXOff();
|
||||
int zOff = ac.getZOff();
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case 1:
|
||||
if (!(world.getTileEntity(x + xOff, y, z - zOff) instanceof TESocket))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (!(world.getTileEntity(x + zOff, y, z + xOff) instanceof TESocket))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if (!(world.getTileEntity(x - xOff, y, z + zOff) instanceof TESocket))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if (!(world.getTileEntity(x - zOff, y, z - xOff) instanceof TESocket))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
if (!(world.getTileEntity(x + xOff, y + zOff, z) instanceof TESocket))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 6:
|
||||
if (!(world.getTileEntity(x, y + zOff, z + xOff) instanceof TESocket))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void initializeRecipes()
|
||||
{
|
||||
helmetList.add(new ArmourComponent(-1, 1));
|
||||
helmetList.add(new ArmourComponent(0, 1));
|
||||
helmetList.add(new ArmourComponent(1, 1));
|
||||
helmetList.add(new ArmourComponent(-1, 0));
|
||||
helmetList.add(new ArmourComponent(1, 0));
|
||||
bootsList.add(new ArmourComponent(-1, 1));
|
||||
bootsList.add(new ArmourComponent(1, 1));
|
||||
bootsList.add(new ArmourComponent(-1, 0));
|
||||
bootsList.add(new ArmourComponent(1, 0));
|
||||
plateList.add(new ArmourComponent(-1, 0));
|
||||
plateList.add(new ArmourComponent(1, 0));
|
||||
plateList.add(new ArmourComponent(-1, -1));
|
||||
plateList.add(new ArmourComponent(0, -1));
|
||||
plateList.add(new ArmourComponent(1, -1));
|
||||
plateList.add(new ArmourComponent(-1, -2));
|
||||
plateList.add(new ArmourComponent(0, -2));
|
||||
plateList.add(new ArmourComponent(1, -2));
|
||||
leggingsList.add(new ArmourComponent(-1, 1));
|
||||
leggingsList.add(new ArmourComponent(0, 1));
|
||||
leggingsList.add(new ArmourComponent(1, 1));
|
||||
leggingsList.add(new ArmourComponent(-1, 0));
|
||||
leggingsList.add(new ArmourComponent(1, 0));
|
||||
leggingsList.add(new ArmourComponent(-1, -1));
|
||||
leggingsList.add(new ArmourComponent(1, -1));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,311 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
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.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import WayofTime.alchemicalWizardry.common.PacketHandler;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyBattery;
|
||||
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfHolding;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockAltar extends BlockContainer
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon1;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon bottomIcon;
|
||||
|
||||
public BlockAltar()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("bloodAltar");
|
||||
//setUnlocalizedName("blockAltar");
|
||||
//func_111022_d("AlchemicalWizardry:blocks");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Top");
|
||||
this.sideIcon1 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType1");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType2");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Bottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
|
||||
case 1:
|
||||
return topIcon;
|
||||
|
||||
//case 2: return sideIcon1;
|
||||
//case 3: return sideIcon1;
|
||||
//case 4: return sideIcon2;
|
||||
//case 5: return sideIcon2;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@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.getTileEntity(x, y, z);
|
||||
|
||||
// world.scheduleBlockUpdate(x, y, z, this.blockID, 0);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (playerItem != null)
|
||||
{
|
||||
if (playerItem.getItem().equals(ModItems.divinationSigil))
|
||||
{
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}else
|
||||
{
|
||||
tileEntity.sendChatInfoToPlayer(player);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if(playerItem.getItem().equals(ModItems.itemSeerSigil))
|
||||
{
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}else
|
||||
{
|
||||
tileEntity.sendMoreChatInfoToPlayer(player);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (playerItem.getItem().equals(ModItems.sigilOfHolding))
|
||||
{
|
||||
ItemStack item = ((SigilOfHolding) playerItem.getItem()).getCurrentItem(playerItem);
|
||||
|
||||
if (item != null && item.getItem().equals(ModItems.divinationSigil))
|
||||
{
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}else
|
||||
{
|
||||
tileEntity.sendChatInfoToPlayer(player);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if(item !=null && item.getItem().equals(ModItems.itemSeerSigil))
|
||||
{
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}else
|
||||
{
|
||||
tileEntity.sendMoreChatInfoToPlayer(player);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tileEntity.getStackInSlot(0) == null && playerItem != null)
|
||||
{
|
||||
ItemStack newItem = playerItem.copy();
|
||||
newItem.stackSize = 1;
|
||||
// if(newItem.getMaxDamage()==0)
|
||||
// {
|
||||
// newItem.setItemDamage(0);
|
||||
// }
|
||||
--playerItem.stackSize;
|
||||
tileEntity.setInventorySlotContents(0, newItem);
|
||||
tileEntity.startCycle();
|
||||
} else if (tileEntity.getStackInSlot(0) != null && playerItem == null)
|
||||
{
|
||||
/**stub method
|
||||
* Add the item that is in the slot to the player's inventory, and
|
||||
* then set the slot to null.
|
||||
*/
|
||||
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
|
||||
tileEntity.setInventorySlotContents(0, null);
|
||||
tileEntity.setActive();
|
||||
}
|
||||
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
//player.openGui(AlchemicalWizardry.instance, 0, world, x, y, z);
|
||||
//PacketDispatcher.sendPacketToServer(tileEntity.getDescriptionPacket());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
if (item != null && item.stackSize > 0)
|
||||
{
|
||||
float rx = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = rand.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world,
|
||||
x + rx, y + ry, z + rz,
|
||||
new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
item.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
|
||||
{
|
||||
TEAltar tileEntity = (TEAltar) world.getTileEntity(x, y, z);
|
||||
|
||||
if (!tileEntity.isActive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (rand.nextInt(3) != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public int isProvidingStrongPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
||||
// {
|
||||
// return 1;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean canProvidePower()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
TileEntity tile = par1IBlockAccess.getTileEntity(par2, par3, par4);
|
||||
|
||||
if (tile instanceof TEAltar)
|
||||
{
|
||||
// if(tile.worldObj.isRemote)
|
||||
// {
|
||||
// return 0;
|
||||
// }
|
||||
ItemStack stack = ((TEAltar) tile).getStackInSlot(0);
|
||||
|
||||
if (stack != null && stack.getItem() instanceof EnergyBattery)
|
||||
{
|
||||
EnergyBattery bloodOrb = (EnergyBattery) stack.getItem();
|
||||
int maxEssence = bloodOrb.getMaxEssence();
|
||||
int currentEssence = bloodOrb.getCurrentEssence(stack);
|
||||
int level = currentEssence * 15 / maxEssence;
|
||||
return ((int) (Math.min(15, level))) % 16;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2)
|
||||
{
|
||||
return new TEAltar();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockBloodLightSource extends Block
|
||||
{
|
||||
public BlockBloodLightSource()
|
||||
{
|
||||
super(Material.cloth);
|
||||
//setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("blockBloodLightSource");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:BlockBloodLight");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
|
||||
{
|
||||
if (rand.nextInt(3) != 0)
|
||||
{
|
||||
float f = (float) 1.0F;
|
||||
float f1 = f * 0.6F + 0.4F;
|
||||
float f2 = f * f * 0.7F - 0.5F;
|
||||
float f3 = f * f * 0.6F - 0.7F;
|
||||
world.spawnParticle("reddust", x + 0.5D + rand.nextGaussian() / 8, y + 0.5D, z + 0.5D + rand.nextGaussian() / 8, f1, f2, f3);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity)
|
||||
{
|
||||
this.setBlockBounds(0.40F, 0.40F, 0.40F, 0.60F, 0.60F, 0.60F);
|
||||
//super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
|
||||
}
|
||||
|
||||
public int quantityDropped(Random par1Random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEConduit;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockConduit extends BlockOrientable
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon1;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon bottomIcon;
|
||||
|
||||
public BlockConduit()
|
||||
{
|
||||
super();
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("blockConduit");
|
||||
//func_111022_d("AlchemicalWizardry:blocks");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Top");
|
||||
this.sideIcon1 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType1");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType2");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Bottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
|
||||
case 1:
|
||||
return topIcon;
|
||||
|
||||
//case 2: return sideIcon1;
|
||||
//case 3: return sideIcon1;
|
||||
//case 4: return sideIcon2;
|
||||
//case 5: return sideIcon2;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
//dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int noClue)
|
||||
{
|
||||
return new TEConduit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
package WayofTime.alchemicalWizardry.common.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.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.items.BlankSpell;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEHomHeart;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockHomHeart extends BlockContainer
|
||||
{
|
||||
public IIcon bottomIcon;
|
||||
public IIcon topIcon;
|
||||
public IIcon sideIcon;
|
||||
|
||||
public BlockHomHeart()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("blockHomHeart");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:HomHeart_top");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:HomHeart_bottom");
|
||||
this.sideIcon = iconRegister.registerIcon("AlchemicalWizardry:HomHeart_side");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
|
||||
case 1:
|
||||
return topIcon;
|
||||
|
||||
//case 2: return sideIcon1;
|
||||
//case 3: return sideIcon1;
|
||||
//case 4: return sideIcon2;
|
||||
//case 5: return sideIcon2;
|
||||
default:
|
||||
return sideIcon;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TEHomHeart tileEntity = (TEHomHeart) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (playerItem != null)
|
||||
{
|
||||
if (playerItem.getItem() instanceof BlankSpell)
|
||||
{
|
||||
if (playerItem.stackTagCompound == null)
|
||||
{
|
||||
playerItem.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound itemTag = playerItem.stackTagCompound;
|
||||
itemTag.setInteger("xCoord", x);
|
||||
itemTag.setInteger("yCoord", y);
|
||||
itemTag.setInteger("zCoord", z);
|
||||
itemTag.setInteger("dimensionId", world.provider.dimensionId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int metaMaybe)
|
||||
{
|
||||
return new TEHomHeart();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
package WayofTime.alchemicalWizardry.common.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.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.items.ActivationCrystal;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockMasterStone extends BlockContainer
|
||||
{
|
||||
public BlockMasterStone()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("blockMasterStone");
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:MasterStone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TEMasterStone tileEntity = (TEMasterStone) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (playerItem == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Item item = playerItem.getItem();
|
||||
|
||||
if (!(item instanceof ActivationCrystal))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ActivationCrystal acItem = (ActivationCrystal) item;
|
||||
tileEntity.setOwner(acItem.getOwnerName(playerItem));
|
||||
tileEntity.activateRitual(world, acItem.getCrystalLevel(playerItem), player);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TEMasterStone();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,254 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import javax.swing.Icon;
|
||||
|
||||
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.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEOrientable;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockOrientable extends BlockContainer
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon[] fireIcons;
|
||||
|
||||
public BlockOrientable()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
//setUnlocalizedName("bloodSocket");
|
||||
//func_111022_d("AlchemicalWizardry:blocks");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.fireIcons = this.registerIconsWithString(iconRegister, "fireEffectBlock");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static IIcon[] registerIconsWithString(IIconRegister iconRegister, String blockString)
|
||||
{
|
||||
IIcon[] icons = new IIcon[7];
|
||||
|
||||
icons[0] = iconRegister.registerIcon("AlchemicalWizardry:" + blockString + "_input");
|
||||
icons[1] = iconRegister.registerIcon("AlchemicalWizardry:" + blockString + "_output");
|
||||
icons[2] = iconRegister.registerIcon("AlchemicalWizardry:" + blockString + "_upArrow");
|
||||
icons[3] = iconRegister.registerIcon("AlchemicalWizardry:" + blockString + "_downArrow");
|
||||
icons[4] = iconRegister.registerIcon("AlchemicalWizardry:" + blockString + "_leftArrow");
|
||||
icons[5] = iconRegister.registerIcon("AlchemicalWizardry:" + blockString + "_rightArrow");
|
||||
icons[6] = iconRegister.registerIcon("AlchemicalWizardry:" + blockString + "_blank");
|
||||
|
||||
return icons;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
IIcon[] icons = this.getIconsForMeta(meta);
|
||||
switch (side)
|
||||
{
|
||||
case 4: return icons[1];
|
||||
default: return icons[6];
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
/**
|
||||
* Retrieves the block texture to use based on the display side. Args: iBlockAccess, x, y, z, side
|
||||
*/
|
||||
public IIcon getBlockTexture(IBlockAccess par1IBlockAccess, int x, int y, int z, int side)
|
||||
{
|
||||
TileEntity tile = par1IBlockAccess.getTileEntity(x, y, z);
|
||||
int meta = par1IBlockAccess.getBlockMetadata(x, y, z);
|
||||
|
||||
if(tile instanceof TEOrientable)
|
||||
{
|
||||
ForgeDirection input = ((TEOrientable)tile).getInputDirection();
|
||||
ForgeDirection output = ((TEOrientable)tile).getOutputDirection();
|
||||
|
||||
return this.getIconsForMeta(meta)[this.getTextureIndexForSideAndOrientation(side, input, output)];
|
||||
}
|
||||
|
||||
return this.getIcon(side, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int dunno)
|
||||
{
|
||||
return new TEOrientable();
|
||||
}
|
||||
|
||||
public IIcon[] getIconsForMeta(int metadata)
|
||||
{
|
||||
return this.fireIcons;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are)
|
||||
{
|
||||
//Right-click orients the output face. Shift-right-click orients the input face.
|
||||
if (world.isRemote)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ForgeDirection sideClicked = ForgeDirection.getOrientation(side);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof TEOrientable)
|
||||
{
|
||||
TEOrientable newTile = (TEOrientable)tile;
|
||||
if(player.isSneaking())
|
||||
{
|
||||
int nextSide = TEOrientable.getIntForForgeDirection(newTile.getInputDirection())+1;
|
||||
|
||||
if(nextSide>5)
|
||||
{
|
||||
nextSide = 0;
|
||||
}
|
||||
if(ForgeDirection.getOrientation(nextSide)==newTile.getOutputDirection())
|
||||
{
|
||||
nextSide++;
|
||||
if(nextSide>5)
|
||||
{
|
||||
nextSide = 0;
|
||||
}
|
||||
}
|
||||
|
||||
newTile.setInputDirection(ForgeDirection.getOrientation(nextSide));
|
||||
}else
|
||||
{
|
||||
int nextSide = TEOrientable.getIntForForgeDirection(newTile.getOutputDirection())+1;
|
||||
|
||||
if(nextSide>5)
|
||||
{
|
||||
nextSide = 0;
|
||||
}
|
||||
if(ForgeDirection.getOrientation(nextSide)==newTile.getInputDirection())
|
||||
{
|
||||
nextSide++;
|
||||
if(nextSide>5)
|
||||
{
|
||||
nextSide = 0;
|
||||
}
|
||||
}
|
||||
|
||||
newTile.setOutputDirection(ForgeDirection.getOrientation(nextSide));
|
||||
}
|
||||
}
|
||||
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getTextureIndexForSideAndOrientation(int side, ForgeDirection input, ForgeDirection output)
|
||||
{
|
||||
if(ForgeDirection.getOrientation(side) == input)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if(ForgeDirection.getOrientation(side) == output)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if(ForgeDirection.getOrientation(side) == output.getOpposite())
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
switch(side)
|
||||
{
|
||||
case 0: //BOTTOM
|
||||
switch(output)
|
||||
{
|
||||
case NORTH: return 2; //UP
|
||||
case SOUTH: return 3; //DOWN
|
||||
case EAST: return 4; //LEFT
|
||||
case WEST: return 5; //RIGHT
|
||||
default: break;
|
||||
}
|
||||
break;
|
||||
case 1: //TOP
|
||||
switch(output)
|
||||
{
|
||||
case NORTH: return 2; //UP
|
||||
case SOUTH: return 3; //DOWN
|
||||
case EAST: return 5;
|
||||
case WEST: return 4;
|
||||
default: break;
|
||||
}
|
||||
break;
|
||||
case 2: //NORTH
|
||||
switch(output)
|
||||
{
|
||||
case DOWN: return 3;
|
||||
case UP: return 2;
|
||||
case EAST: return 4;
|
||||
case WEST: return 5;
|
||||
default: break;
|
||||
}
|
||||
break;
|
||||
case 3: //SOUTH
|
||||
switch(output)
|
||||
{
|
||||
case DOWN: return 3;
|
||||
case UP: return 2;
|
||||
case EAST: return 5;
|
||||
case WEST: return 4;
|
||||
default: break;
|
||||
}
|
||||
break;
|
||||
case 4: //WEST
|
||||
switch(output)
|
||||
{
|
||||
case DOWN: return 3;
|
||||
case UP: return 2;
|
||||
case NORTH: return 5;
|
||||
case SOUTH: return 4;
|
||||
default: break;
|
||||
}
|
||||
break;
|
||||
case 5: //EAST
|
||||
switch(output)
|
||||
{
|
||||
case DOWN: return 3;
|
||||
case UP: return 2;
|
||||
case NORTH: return 4;
|
||||
case SOUTH: return 5;
|
||||
default: break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int metadata)
|
||||
{
|
||||
return metadata;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,193 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
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.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEPedestal;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockPedestal extends BlockContainer
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon1;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon bottomIcon;
|
||||
|
||||
public BlockPedestal()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("bloodPedestal");
|
||||
//func_111022_d("AlchemicalWizardry:blocks");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:ArcanePedestal");
|
||||
this.sideIcon1 = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
|
||||
case 1:
|
||||
return topIcon;
|
||||
|
||||
//case 2: return sideIcon1;
|
||||
//case 3: return sideIcon1;
|
||||
//case 4: return sideIcon2;
|
||||
//case 5: return sideIcon2;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TEPedestal tileEntity = (TEPedestal) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (tileEntity.getStackInSlot(0) == null && playerItem != null)
|
||||
{
|
||||
ItemStack newItem = playerItem.copy();
|
||||
newItem.stackSize = 1;
|
||||
--playerItem.stackSize;
|
||||
tileEntity.setInventorySlotContents(0, newItem);
|
||||
} else if (tileEntity.getStackInSlot(0) != null && playerItem == null)
|
||||
{
|
||||
/**stub method
|
||||
* Add the item that is in the slot to the player's inventory, and
|
||||
* then set the slot to null.
|
||||
*/
|
||||
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
|
||||
tileEntity.setInventorySlotContents(0, null);
|
||||
tileEntity.setActive();
|
||||
}
|
||||
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
//player.openGui(AlchemicalWizardry.instance, 0, world, x, y, z);
|
||||
//PacketDispatcher.sendPacketToServer(tileEntity.getDescriptionPacket());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
if (item != null && item.stackSize > 0)
|
||||
{
|
||||
float rx = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = rand.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
item.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TEPedestal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MovingObjectPosition collisionRayTrace(World par1World, int par2, int par3, int par4, Vec3 par5Vec3, Vec3 par6Vec3)
|
||||
{
|
||||
float f = 0.3125F;
|
||||
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.6F, 0.5F + f);
|
||||
return super.collisionRayTrace(par1World, par2, par3, par4, par5Vec3, par6Vec3);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,193 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
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.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockPlinth extends BlockContainer
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon1;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon bottomIcon;
|
||||
|
||||
public BlockPlinth()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("bloodPlinth");
|
||||
//func_111022_d("AlchemicalWizardry:blocks");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:ArcanePlinth");
|
||||
this.sideIcon1 = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
|
||||
case 1:
|
||||
return topIcon;
|
||||
|
||||
//case 2: return sideIcon1;
|
||||
//case 3: return sideIcon1;
|
||||
//case 4: return sideIcon2;
|
||||
//case 5: return sideIcon2;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TEPlinth tileEntity = (TEPlinth) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (tileEntity.getStackInSlot(0) == null && playerItem != null)
|
||||
{
|
||||
ItemStack newItem = playerItem.copy();
|
||||
newItem.stackSize = 1;
|
||||
--playerItem.stackSize;
|
||||
tileEntity.setInventorySlotContents(0, newItem);
|
||||
} else if (tileEntity.getStackInSlot(0) != null && playerItem == null)
|
||||
{
|
||||
/**stub method
|
||||
* Add the item that is in the slot to the player's inventory, and
|
||||
* then set the slot to null.
|
||||
*/
|
||||
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
|
||||
tileEntity.setInventorySlotContents(0, null);
|
||||
tileEntity.setActive();
|
||||
}
|
||||
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
//player.openGui(AlchemicalWizardry.instance, 0, world, x, y, z);
|
||||
//PacketDispatcher.sendPacketToServer(tileEntity.getDescriptionPacket());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
if (item != null && item.stackSize > 0)
|
||||
{
|
||||
float rx = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = rand.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
item.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TEPlinth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MovingObjectPosition collisionRayTrace(World par1World, int par2, int par3, int par4, Vec3 par5Vec3, Vec3 par6Vec3)
|
||||
{
|
||||
float f = 0.0625F;
|
||||
this.setBlockBounds(f, 0.0F, f, 1.0f - f, 0.875f, 1.0f - f);
|
||||
return super.collisionRayTrace(par1World, par2, par3, par4, par5Vec3, par6Vec3);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,163 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
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.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESocket;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockSocket extends BlockContainer
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon1;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon bottomIcon;
|
||||
|
||||
public BlockSocket()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("bloodSocket");
|
||||
//func_111022_d("AlchemicalWizardry:blocks");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
this.sideIcon1 = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
|
||||
case 1:
|
||||
return topIcon;
|
||||
|
||||
//case 2: return sideIcon1;
|
||||
//case 3: return sideIcon1;
|
||||
//case 4: return sideIcon2;
|
||||
//case 5: return sideIcon2;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TESocket tileEntity = (TESocket) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (tileEntity.getStackInSlot(0) == null && playerItem != null)
|
||||
{
|
||||
if (playerItem.getItem() instanceof ArmourUpgrade)
|
||||
{
|
||||
ItemStack newItem = playerItem.copy();
|
||||
newItem.stackSize = 1;
|
||||
--playerItem.stackSize;
|
||||
tileEntity.setInventorySlotContents(0, newItem);
|
||||
}
|
||||
} else if (tileEntity.getStackInSlot(0) != null && playerItem == null)
|
||||
{
|
||||
/**stub method
|
||||
* Add the item that is in the slot to the player's inventory, and
|
||||
* then set the slot to null.
|
||||
*/
|
||||
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
|
||||
tileEntity.setInventorySlotContents(0, null);
|
||||
tileEntity.setActive();
|
||||
}
|
||||
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
//player.openGui(AlchemicalWizardry.instance, 0, world, x, y, z);
|
||||
//PacketDispatcher.sendPacketToServer(tileEntity.getDescriptionPacket());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
if (item != null && item.stackSize > 0)
|
||||
{
|
||||
float rx = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = rand.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
item.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TESocket();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralContainer;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockSpectralContainer extends BlockContainer
|
||||
{
|
||||
public BlockSpectralContainer()
|
||||
{
|
||||
super(Material.cloth);
|
||||
//setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("blockSpectralContainer");
|
||||
this.setBlockBounds(0,0,0,0,0,0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:BlockBloodLight");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public int quantityDropped(Random par1Random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReplaceable(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAir(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2)
|
||||
{
|
||||
return new TESpectralContainer();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEffectBlock;
|
||||
|
||||
|
||||
public class BlockSpellEffect extends BlockOrientable
|
||||
{
|
||||
public BlockSpellEffect()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("blockSpellEffect");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TESpellEffectBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
if (this.equals(ModBlocks.blockSpellEffect))
|
||||
{
|
||||
for(int i=0; i<4; i++)
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, i));
|
||||
}
|
||||
} else
|
||||
{
|
||||
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEffectBlock;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEnhancementBlock;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellModifierBlock;
|
||||
|
||||
|
||||
public class BlockSpellEnhancement extends BlockOrientable
|
||||
{
|
||||
public BlockSpellEnhancement()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("blockSpellEnhancement");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TESpellEnhancementBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
if (this.equals(ModBlocks.blockSpellEnhancement))
|
||||
{
|
||||
for(int i=0; i<15; i++)
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, i));
|
||||
}
|
||||
} else
|
||||
{
|
||||
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEffectBlock;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellModifierBlock;
|
||||
|
||||
|
||||
public class BlockSpellModifier extends BlockOrientable
|
||||
{
|
||||
public BlockSpellModifier()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("blockSpellModifier");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TESpellModifierBlock();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
if (this.equals(ModBlocks.blockSpellModifier))
|
||||
{
|
||||
for(int i=0; i<4; i++)
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, i));
|
||||
}
|
||||
} else
|
||||
{
|
||||
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,212 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.common.items.ItemComplexSpellCrystal;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellParadigmBlock;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockSpellParadigm extends BlockOrientable
|
||||
{
|
||||
public static final float minPos = (3f/16f);
|
||||
public static final float maxPos = (13f/16f);
|
||||
|
||||
IIcon[] projectileIcons = new IIcon[7];
|
||||
|
||||
public BlockSpellParadigm()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("blockSpellParadigm");
|
||||
//setBlockBounds(minPos, minPos, minPos, maxPos, maxPos, maxPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.projectileIcons = this.registerIconsWithString(iconRegister, "projectileParadigmBlock");
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public Icon[] getIconsForMeta(int metadata)
|
||||
// {
|
||||
// return this.projectileIcons;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TESpellParadigmBlock();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
/**
|
||||
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
|
||||
*/
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
if (this.equals(ModBlocks.blockSpellParadigm))
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, 0));
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
par3List.add(new ItemStack(par1, 1, 2));
|
||||
par3List.add(new ItemStack(par1, 1, 3));
|
||||
} else
|
||||
{
|
||||
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are)
|
||||
{
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
|
||||
if(stack != null && stack.getItem() instanceof ItemComplexSpellCrystal)
|
||||
{
|
||||
if (stack.stackTagCompound == null)
|
||||
{
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound itemTag = stack.stackTagCompound;
|
||||
itemTag.setInteger("xCoord", x);
|
||||
itemTag.setInteger("yCoord", y);
|
||||
itemTag.setInteger("zCoord", z);
|
||||
itemTag.setInteger("dimensionId", world.provider.dimensionId);
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onBlockActivated(world, x, y, z, player, side, what, these, are);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
//TODO Need to make a renderer for the paradigm blocks and other spell blocks.
|
||||
/*
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List arraylist, Entity par7Entity)
|
||||
{
|
||||
|
||||
setBlockBounds(minPos, minPos, minPos, maxPos, maxPos, maxPos);
|
||||
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
|
||||
|
||||
TileEntity tile1 = world.getBlockTileEntity(i, j, k);
|
||||
if (tile1 instanceof TESpellParadigmBlock)
|
||||
{
|
||||
TESpellParadigmBlock tileG = (TESpellParadigmBlock) tile1;
|
||||
|
||||
|
||||
if (tileG.isSideRendered(ForgeDirection.WEST))
|
||||
{
|
||||
setBlockBounds(0.0F, minPos, minPos, maxPos, maxPos, maxPos);
|
||||
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
}
|
||||
|
||||
|
||||
if (tileG.isSideRendered(ForgeDirection.EAST))
|
||||
{
|
||||
setBlockBounds(minPos, minPos, minPos, 1.0F, maxPos, maxPos);
|
||||
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
}
|
||||
|
||||
|
||||
if (tileG.isSideRendered(ForgeDirection.DOWN))
|
||||
{
|
||||
setBlockBounds(minPos, 0.0F, minPos, maxPos, maxPos, maxPos);
|
||||
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
}
|
||||
|
||||
|
||||
if (tileG.isSideRendered(ForgeDirection.UP))
|
||||
{
|
||||
setBlockBounds(minPos, minPos, minPos, maxPos, 1.0F, maxPos);
|
||||
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
}
|
||||
|
||||
|
||||
if (tileG.isSideRendered(ForgeDirection.NORTH))
|
||||
{
|
||||
setBlockBounds(minPos, minPos, 0.0F, maxPos, maxPos, maxPos);
|
||||
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
}
|
||||
|
||||
|
||||
if (tileG.isSideRendered(ForgeDirection.SOUTH))
|
||||
{
|
||||
setBlockBounds(minPos, minPos, minPos, maxPos, maxPos, 1.0F);
|
||||
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
}
|
||||
|
||||
|
||||
// float facadeThickness = TransportConstants.FACADE_THICKNESS;
|
||||
//
|
||||
//
|
||||
// if (tileG.hasFacade(ForgeDirection.EAST)) {
|
||||
// setBlockBounds(1 - facadeThickness, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
// super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if (tileG.hasFacade(ForgeDirection.WEST)) {
|
||||
// setBlockBounds(0.0F, 0.0F, 0.0F, facadeThickness, 1.0F, 1.0F);
|
||||
// super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if (tileG.hasFacade(ForgeDirection.UP)) {
|
||||
// setBlockBounds(0.0F, 1 - facadeThickness, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
// super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if (tileG.hasFacade(ForgeDirection.DOWN)) {
|
||||
// setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, facadeThickness, 1.0F);
|
||||
// super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if (tileG.hasFacade(ForgeDirection.SOUTH)) {
|
||||
// setBlockBounds(0.0F, 0.0F, 1 - facadeThickness, 1.0F, 1.0F, 1.0F);
|
||||
// super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if (tileG.hasFacade(ForgeDirection.NORTH)) {
|
||||
// setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, facadeThickness);
|
||||
// super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
// }
|
||||
}
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
*/
|
||||
}
|
|
@ -0,0 +1,321 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import javax.swing.Icon;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.BlockMobSpawner;
|
||||
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.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.items.TelepositionFocus;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockTeleposer extends BlockContainer
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon1;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon bottomIcon;
|
||||
|
||||
public BlockTeleposer()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("bloodTeleposer");
|
||||
//func_111022_d("AlchemicalWizardry:blocks");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Top");
|
||||
this.sideIcon1 = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Side");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Side");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Side");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
|
||||
case 1:
|
||||
return topIcon;
|
||||
|
||||
//case 2: return sideIcon1;
|
||||
//case 3: return sideIcon1;
|
||||
//case 4: return sideIcon2;
|
||||
//case 5: return sideIcon2;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TETeleposer tileEntity = (TETeleposer) world.getTileEntity(x, y, z);
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (playerItem != null)
|
||||
{
|
||||
if (playerItem.getItem() instanceof TelepositionFocus)
|
||||
{
|
||||
if (playerItem.stackTagCompound == null)
|
||||
{
|
||||
playerItem.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound itemTag = playerItem.stackTagCompound;
|
||||
itemTag.setInteger("xCoord", x);
|
||||
itemTag.setInteger("yCoord", y);
|
||||
itemTag.setInteger("zCoord", z);
|
||||
itemTag.setInteger("dimensionId", world.provider.dimensionId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
player.openGui(AlchemicalWizardry.instance, 1, world, x, y, z);
|
||||
// this.swapBlocks(world, x, y+1, z, x, y+2, z);
|
||||
//
|
||||
// world.markBlockForUpdate(x, y, z);
|
||||
//player.openGui(AlchemicalWizardry.instance, 0, world, x, y, z);
|
||||
//PacketDispatcher.sendPacketToServer(tileEntity.getDescriptionPacket());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
if (item != null && item.stackSize > 0)
|
||||
{
|
||||
float rx = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = rand.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
item.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TETeleposer();
|
||||
}
|
||||
|
||||
public static boolean swapBlocks(World worldI, World worldF, int xi, int yi, int zi, int xf, int yf, int zf)
|
||||
{
|
||||
//TODO Fix sapling duplication glitch
|
||||
TileEntity tileEntityI = worldI.getTileEntity(xi, yi, zi);
|
||||
TileEntity tileEntityF = worldF.getTileEntity(xf, yf, zf);
|
||||
TileEntity tileI;
|
||||
TileEntity tileF;
|
||||
// ItemStack[] inv1 = new ItemStack[0];
|
||||
// ItemStack[] inv2 = new ItemStack[0];
|
||||
NBTTagCompound nbttag1 = new NBTTagCompound();
|
||||
NBTTagCompound nbttag2 = new NBTTagCompound();
|
||||
|
||||
if (tileEntityI != null)
|
||||
{
|
||||
//NBTTagCompound nbttag1 = new NBTTagCompound();
|
||||
// tileEntityI.xCoord=xf;
|
||||
// tileEntityI.yCoord=yf;
|
||||
// tileEntityI.zCoord=zf;
|
||||
tileEntityI.writeToNBT(nbttag1);
|
||||
//tileEntityI.readFromNBT(new NBTTagCompound());
|
||||
}
|
||||
|
||||
// if(tileEntityI instanceof IInventory)
|
||||
// {
|
||||
// int size = ((IInventory)tileEntityI).getSizeInventory();
|
||||
// inv1 = new ItemStack[size];
|
||||
// for(int i=0; i<size; i++)
|
||||
// {
|
||||
// inv1[i] = ((IInventory)tileEntityI).getStackInSlot(i);
|
||||
// ((IInventory)tileEntityI).setInventorySlotContents(i, null);
|
||||
// }
|
||||
// }
|
||||
|
||||
if (tileEntityF != null)
|
||||
{
|
||||
// tileEntityF.xCoord=xi;
|
||||
// tileEntityF.yCoord=yi;
|
||||
// tileEntityF.zCoord=zi;
|
||||
tileEntityF.writeToNBT(nbttag2);
|
||||
}
|
||||
|
||||
// if(tileEntityF instanceof IInventory)
|
||||
// {
|
||||
// int size = ((IInventory)tileEntityF).getSizeInventory();
|
||||
// inv2 = new ItemStack[size];
|
||||
// for(int i=0; i<size; i++)
|
||||
// {
|
||||
// inv2[i] = ((IInventory)tileEntityF).getStackInSlot(i);
|
||||
// ((IInventory)tileEntityF).setInventorySlotContents(i, null);
|
||||
// }
|
||||
// }
|
||||
Block blockI = worldI.getBlock(xi, yi, zi);
|
||||
Block blockF = worldF.getBlock(xf, yf, zf);
|
||||
|
||||
// if(ThaumcraftApi.portableHoleBlackList.contains(idI)||ThaumcraftApi.portableHoleBlackList.contains(idF))
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
if (blockI.equals(Blocks.air) && blockF.equals(Blocks.air))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//if(Block.blocksList[idI] instanceof IPlantable || Block.blocksList[idF] instanceof IPlantable||Block.blocksList[idI] instanceof BlockMobSpawner || Block.blocksList[idF] instanceof BlockMobSpawner)
|
||||
if (blockI instanceof BlockMobSpawner || blockF instanceof BlockMobSpawner)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int metaI = worldI.getBlockMetadata(xi, yi, zi);
|
||||
int metaF = worldF.getBlockMetadata(xf, yf, zf);
|
||||
worldI.playSoundEffect(xi, yi, zi, "mob.endermen.portal", 1.0F, 1.0F);
|
||||
worldF.playSoundEffect(xf, yf, zf, "mob.endermen.portal", 1.0F, 1.0F);
|
||||
//CLEAR TILES
|
||||
Block finalBlock = blockF;
|
||||
|
||||
if (finalBlock != null)
|
||||
{
|
||||
TileEntity tileToSet = finalBlock.createTileEntity(worldF, metaF);
|
||||
// tileToSet.xCoord = xf;
|
||||
// tileToSet.yCoord = yf;
|
||||
// tileToSet.zCoord = zf;
|
||||
worldF.setTileEntity(xf, yf, zf, tileToSet);
|
||||
}
|
||||
|
||||
Block initialBlock = blockI;
|
||||
|
||||
if (initialBlock != null)
|
||||
{
|
||||
TileEntity tileToSet = initialBlock.createTileEntity(worldI, metaI);
|
||||
// tileToSet.xCoord = xi;
|
||||
// tileToSet.yCoord = yi;
|
||||
// tileToSet.zCoord = zi;
|
||||
worldI.setTileEntity(xi, yi, zi, tileToSet);
|
||||
}
|
||||
|
||||
//TILES CLEARED
|
||||
// worldF.destroyBlock(xf, yf, zf, false);
|
||||
// worldI.destroyBlock(xi, yi, zi, false);
|
||||
// worldI.setBlockToAir(xi, yi, zi);
|
||||
// worldF.setBlockToAir(xf, yf, zf);
|
||||
worldF.setBlock(xf, yf, zf, initialBlock, metaI, 3);
|
||||
|
||||
if (tileEntityI != null)
|
||||
{
|
||||
TileEntity newTileEntityI = TileEntity.createAndLoadEntity(nbttag1);
|
||||
worldF.setTileEntity(xf, yf, zf, newTileEntityI);
|
||||
newTileEntityI.xCoord = xf;
|
||||
newTileEntityI.yCoord = yf;
|
||||
newTileEntityI.zCoord = zf;
|
||||
}
|
||||
|
||||
worldI.setBlock(xi, yi, zi, finalBlock, metaF, 3);
|
||||
|
||||
if (tileEntityF != null)
|
||||
{
|
||||
TileEntity newTileEntityF = TileEntity.createAndLoadEntity(nbttag2);
|
||||
worldI.setTileEntity(xi, yi, zi, newTileEntityF);
|
||||
newTileEntityF.xCoord = xi;
|
||||
newTileEntityF.yCoord = yi;
|
||||
newTileEntityF.zCoord = zi;
|
||||
}
|
||||
|
||||
// if(finalBlock!=null)
|
||||
// finalBlock.onNeighborBlockChange(worldI, xi, yi, zi, AlchemicalWizardry.blockTeleposer.blockID);
|
||||
// if(initialBlock!=null)
|
||||
// initialBlock.onNeighborBlockChange(worldF, xf, yf, zf, AlchemicalWizardry.blockTeleposer.blockID);
|
||||
// tileI = worldI.getBlockTileEntity(xi, yi, zi);
|
||||
// tileF = worldF.getBlockTileEntity(xf, yf, zf);
|
||||
// if(tileI!=null)
|
||||
// {
|
||||
// tileI.readFromNBT(nbttag2);
|
||||
// }
|
||||
//
|
||||
// if(tileF!=null)
|
||||
// {
|
||||
// tileF.readFromNBT(nbttag1);
|
||||
// }
|
||||
// if(tileI instanceof IInventory && inv2.length>0)
|
||||
// {
|
||||
// for(int i=0;i<((IInventory)tileI).getSizeInventory();i++)
|
||||
// {
|
||||
// ((IInventory)tileI).setInventorySlotContents(i, inv2[i]);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if(tileF instanceof IInventory && inv1.length>0)
|
||||
// {
|
||||
// for(int i=0;i<((IInventory)tileF).getSizeInventory();i++)
|
||||
// {
|
||||
// ((IInventory)tileF).setInventorySlotContents(i, inv1[i]);
|
||||
// }
|
||||
// }
|
||||
// worldI.markBlockForUpdate(xi, yi, zi);
|
||||
// worldF.markBlockForUpdate(xf, yf, zf);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,181 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
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.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockWritingTable extends BlockContainer
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon1;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon bottomIcon;
|
||||
|
||||
public BlockWritingTable()
|
||||
{
|
||||
super(Material.wood);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
this.setBlockName("blockWritingTable");
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:AlchemicChemistrySet");
|
||||
this.sideIcon1 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType1");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType2");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Bottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
|
||||
case 1:
|
||||
return topIcon;
|
||||
|
||||
//case 2: return sideIcon1;
|
||||
//case 3: return sideIcon1;
|
||||
//case 4: return sideIcon2;
|
||||
//case 5: return sideIcon2;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int metadata, float what, float these, float are)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//code to open gui explained later
|
||||
player.openGui(AlchemicalWizardry.instance, 0, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
if (item != null && item.stackSize > 0)
|
||||
{
|
||||
float rx = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = rand.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world,
|
||||
x + rx, y + ry, z + rz,
|
||||
new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
item.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TEWritingTable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity)
|
||||
{
|
||||
this.setBlockBounds(0.4375F, 0.0F, 0.4375F, 0.5625F, 0.9375F, 0.5625F);
|
||||
super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
|
||||
this.setBlockBoundsForItemRender();
|
||||
super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
|
||||
}
|
||||
|
||||
public void setBlockBoundsForItemRender()
|
||||
{
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BloodRune extends Block
|
||||
{
|
||||
//private Icon bloodRuneIcon;
|
||||
private IIcon altarCapacityRuneIcon;
|
||||
private IIcon dislocationRuneIcon;
|
||||
private IIcon orbCapacityRuneIcon;
|
||||
|
||||
public BloodRune()
|
||||
{
|
||||
super(Material.iron);
|
||||
this.setBlockName("bloodRune");
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:BlankRune");
|
||||
this.altarCapacityRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:AltarCapacityRune");
|
||||
this.dislocationRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:DislocationRune");
|
||||
this.orbCapacityRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:OrbCapacityRune");
|
||||
}
|
||||
|
||||
public int getRuneEffect(int metaData)
|
||||
{
|
||||
switch (metaData)
|
||||
{
|
||||
case 0:
|
||||
return 0;
|
||||
|
||||
case 1: //Altar Capacity rune
|
||||
return 5;
|
||||
|
||||
case 2: //Filling/emptying rune
|
||||
return 6;
|
||||
|
||||
case 3: //Orb Capacity rune
|
||||
return 7;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
/**
|
||||
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
|
||||
*/
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
if (this.equals(ModBlocks.bloodRune))
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, 0));
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
par3List.add(new ItemStack(par1, 1, 2));
|
||||
par3List.add(new ItemStack(par1, 1, 3));
|
||||
} else
|
||||
{
|
||||
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (meta)
|
||||
{
|
||||
case 0:
|
||||
return blockIcon;
|
||||
|
||||
case 1:
|
||||
return altarCapacityRuneIcon;
|
||||
|
||||
case 2:
|
||||
return dislocationRuneIcon;
|
||||
|
||||
case 3:
|
||||
return this.orbCapacityRuneIcon;
|
||||
|
||||
default:
|
||||
return blockIcon;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int metadata)
|
||||
{
|
||||
return metadata;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BloodStoneBrick extends Block
|
||||
{
|
||||
public BloodStoneBrick()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("bloodStoneBrick");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodStoneBrick");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class EfficiencyRune extends BloodRune
|
||||
{
|
||||
public EfficiencyRune()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("efficiencyRune");
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:EfficiencyRune");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRuneEffect(int metaData)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class EmptySocket extends Block
|
||||
{
|
||||
public EmptySocket()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("emptySocket");
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:EmptySocket");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IOrientable
|
||||
{
|
||||
public ForgeDirection getInputDirection();
|
||||
|
||||
public ForgeDirection getOutputDirection();
|
||||
|
||||
public void setInputDirection(ForgeDirection direction);
|
||||
|
||||
public void setOutputDirection(ForgeDirection direction);
|
||||
}
|
|
@ -0,0 +1,143 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.entity.monster.EntityZombie;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.PacketHandler;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ImperfectRitualStone extends Block
|
||||
{
|
||||
public ImperfectRitualStone()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("imperfectRitualStone");
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:ImperfectRitualStone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float xOff, float yOff, float zOff)
|
||||
{
|
||||
//ItemStack ist = player.getItemInUse();
|
||||
//if (!world.isRemote)
|
||||
{
|
||||
Block block = world.getBlock(x, y + 1, z);
|
||||
|
||||
if (block == Blocks.water)
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode && world.isRemote)
|
||||
{
|
||||
|
||||
//PacketDispatcher.sendPacketToServer(PacketHandler.getPacket(SpellHelper.getUsername(player) , -5000, 0));
|
||||
}
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z));
|
||||
// if (!player.capabilities.isCreativeMode)
|
||||
// {
|
||||
// PacketDispatcher.sendPacketToServer(PacketHandler.getPacket(player.getEntityName(), -5000, 0));
|
||||
// }
|
||||
}
|
||||
|
||||
world.getWorldInfo().setRaining(true);
|
||||
|
||||
if (world.isRemote)
|
||||
{
|
||||
world.setRainStrength(1.0F);
|
||||
}
|
||||
|
||||
world.setThunderStrength(1.0f);
|
||||
world.getWorldInfo().setThunderTime(0);
|
||||
world.getWorldInfo().setThundering(true);
|
||||
return true;
|
||||
} else if (block == Blocks.coal_block)
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode && world.isRemote)
|
||||
{
|
||||
EnergyItems.drainPlayerNetwork(player, 5000);
|
||||
}
|
||||
|
||||
//EntityFallenAngel zomb = new EntityFallenAngel(world);
|
||||
EntityZombie zomb = new EntityZombie(world);
|
||||
zomb.setPosition(x + 0.5, y + 2, z + 0.5);
|
||||
// zomb.setCurrentItemOrArmor(4, new ItemStack(Item.helmetIron.itemID,1,0));
|
||||
// zomb.setCurrentItemOrArmor(3, new ItemStack(Item.plateIron.itemID,1,0));
|
||||
// zomb.setCurrentItemOrArmor(2, new ItemStack(Item.legsIron.itemID,1,0));
|
||||
// zomb.setCurrentItemOrArmor(1, new ItemStack(Item.bootsIron.itemID,1,0));
|
||||
//zomb.setCurrentItemOrArmor(0, new ItemStack(AlchemicalWizardry.energySword.itemID,1,0));
|
||||
zomb.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 2000));
|
||||
zomb.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 20000, 7));
|
||||
zomb.addPotionEffect(new PotionEffect(Potion.resistance.id, 20000, 3));
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.spawnEntityInWorld(zomb);
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z));
|
||||
// if (!player.capabilities.isCreativeMode)
|
||||
// {
|
||||
// PacketDispatcher.sendPacketToServer(PacketHandler.getPacket(player.getEntityName(), -5000, 0));
|
||||
// }
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (block== Blocks.lapis_block)
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode && world.isRemote)
|
||||
{
|
||||
EnergyItems.drainPlayerNetwork(player, 5000);
|
||||
}
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z));
|
||||
world.setWorldTime((world.getWorldTime() / 24000) * 24000 + 13800);
|
||||
// if (!player.capabilities.isCreativeMode)
|
||||
// {
|
||||
// PacketDispatcher.sendPacketToServer(PacketHandler.getPacket(player.getEntityName(), -5000, 0));
|
||||
// }
|
||||
}
|
||||
} else if (block == Blocks.bedrock)
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode && world.isRemote)
|
||||
{
|
||||
EnergyItems.drainPlayerNetwork(player, 5000);
|
||||
}
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z));
|
||||
//world.setWorldTime((world.getWorldTime()/24000)*24000+13800);
|
||||
// if (!player.capabilities.isCreativeMode)
|
||||
// {
|
||||
// PacketDispatcher.sendPacketToServer(PacketHandler.getPacket(player.getEntityName(), -5000, 0));
|
||||
// }
|
||||
}
|
||||
|
||||
player.addPotionEffect(new PotionEffect(Potion.resistance.id, 60 * 20, 1));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class LargeBloodStoneBrick extends Block
|
||||
{
|
||||
public LargeBloodStoneBrick()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("largeBloodStoneBrick");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:LargeBloodStoneBrick");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.BlockFluidClassic;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class LifeEssenceBlock extends BlockFluidClassic
|
||||
{
|
||||
public LifeEssenceBlock()
|
||||
{
|
||||
super(AlchemicalWizardry.lifeEssenceFluid, Material.water);
|
||||
AlchemicalWizardry.lifeEssenceFluid.setBlock(this);
|
||||
AlchemicalWizardry.lifeEssenceFluid.setFlowingIcon(blockIcon);
|
||||
AlchemicalWizardry.lifeEssenceFluid.setStillIcon(blockIcon);
|
||||
//setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("lifeEssenceFluidBlock");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:lifeEssenceStill");
|
||||
//this.getFluid().setIcons(blockIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDisplace(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
if (world.getBlock(x, y, z).getMaterial().isLiquid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return super.canDisplace(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean displaceIfPossible(World world, int x, int y, int z)
|
||||
{
|
||||
if (world.getBlock(x, y, z).getMaterial().isLiquid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return super.displaceIfPossible(world, x, y, z);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
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.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IRitualStone;
|
||||
import WayofTime.alchemicalWizardry.common.items.ScribeTool;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class RitualStone extends Block implements IRitualStone
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon blankIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon waterStoneIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon fireStoneIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon earthStoneIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon airStoneIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon duskStoneIcon;
|
||||
|
||||
public RitualStone()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
this.setBlockName("ritualStone");
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blankIcon = iconRegister.registerIcon("AlchemicalWizardry:RitualStone");
|
||||
this.waterStoneIcon = iconRegister.registerIcon("AlchemicalWizardry:WaterRitualStone");
|
||||
this.fireStoneIcon = iconRegister.registerIcon("AlchemicalWizardry:FireRitualStone");
|
||||
this.earthStoneIcon = iconRegister.registerIcon("AlchemicalWizardry:EarthRitualStone");
|
||||
this.airStoneIcon = iconRegister.registerIcon("AlchemicalWizardry:AirRitualStone");
|
||||
this.duskStoneIcon = iconRegister.registerIcon("AlchemicalWizardry:DuskRitualStone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int metadata)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (playerItem == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Item item = playerItem.getItem();
|
||||
|
||||
if (!(item instanceof ScribeTool))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (playerItem.getMaxDamage() <= playerItem.getItemDamage() && !(playerItem.getMaxDamage() == 0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ScribeTool scribeTool = (ScribeTool) item;
|
||||
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
playerItem.setItemDamage(playerItem.getItemDamage() + 1);
|
||||
}
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, scribeTool.getType(), 3);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
switch (metadata)
|
||||
{
|
||||
case 0:
|
||||
return blankIcon;
|
||||
|
||||
case 1:
|
||||
return waterStoneIcon;
|
||||
|
||||
case 2:
|
||||
return fireStoneIcon;
|
||||
|
||||
case 3:
|
||||
return earthStoneIcon;
|
||||
|
||||
case 4:
|
||||
return airStoneIcon;
|
||||
|
||||
case 5:
|
||||
return duskStoneIcon;
|
||||
|
||||
default:
|
||||
return blankIcon;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class RuneOfSacrifice extends BloodRune
|
||||
{
|
||||
public RuneOfSacrifice()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("runeOfSacrifice");
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:RuneOfSacrifice");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRuneEffect(int metaData)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class RuneOfSelfSacrifice extends BloodRune
|
||||
{
|
||||
public RuneOfSelfSacrifice()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("runeOfSelfSacrifice");
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:RuneOfSelfSacrifice");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRuneEffect(int metaData)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class SpectralBlock extends Block
|
||||
{
|
||||
public SpectralBlock()
|
||||
{
|
||||
super(Material.rock);
|
||||
this.setBlockName("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 registerBlockIcons(IIconRegister 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, ((ItemBlock)(playerItem.getItem())).field_150939_a, 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, 100);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class SpeedRune extends BloodRune
|
||||
{
|
||||
public SpeedRune()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("speedRune");
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:SpeedRune");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRuneEffect(int metaData)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue