2013-03-20 08:52:42 -07:00
|
|
|
package test;
|
|
|
|
|
|
|
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
|
|
|
import net.minecraft.entity.Entity;
|
|
|
|
|
import net.minecraft.entity.item.EntityItem;
|
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
|
import net.minecraft.item.Item;
|
|
|
|
|
import net.minecraft.item.ItemStack;
|
2013-04-15 11:04:52 -07:00
|
|
|
import net.minecraft.util.Icon;
|
2013-03-20 08:52:42 -07:00
|
|
|
import net.minecraft.world.World;
|
2013-09-28 21:10:13 -07:00
|
|
|
import bastion.entity.WoodMinecartEntity;
|
2013-03-20 08:52:42 -07:00
|
|
|
|
|
|
|
|
/*
|
2013-04-30 20:22:21 -07:00
|
|
|
* mDiyo's development testing item
|
2013-03-20 08:52:42 -07:00
|
|
|
* Does everything on right-click!
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public class XinStick extends Item
|
|
|
|
|
{
|
2013-07-11 00:07:02 -07:00
|
|
|
public XinStick(int id)
|
2013-04-15 11:04:52 -07:00
|
|
|
{
|
2013-07-11 00:07:02 -07:00
|
|
|
super(id);
|
|
|
|
|
setCreativeTab(CreativeTabs.tabMisc);
|
2013-04-15 11:04:52 -07:00
|
|
|
}
|
2013-03-20 08:52:42 -07:00
|
|
|
|
2013-07-11 00:07:02 -07:00
|
|
|
public Icon getIconFromDamage (int par1)
|
2013-04-17 22:52:40 -07:00
|
|
|
{
|
2013-07-11 00:07:02 -07:00
|
|
|
return Item.arrow.getIconFromDamage(par1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
|
|
|
|
{
|
|
|
|
|
//clearInventoryExeptHotbar(player);
|
2013-09-28 21:10:13 -07:00
|
|
|
WoodMinecartEntity entity = new WoodMinecartEntity(world);
|
|
|
|
|
//entity.setLeader(player);
|
2013-07-13 03:48:08 -07:00
|
|
|
//entity.setCustomNameTag("Cutie");
|
2013-07-11 00:07:02 -07:00
|
|
|
spawnEntity(player.posX, player.posY + 1, player.posZ, entity, world, player);
|
2013-08-16 09:30:56 -07:00
|
|
|
/*EntityChicken chicken = new EntityChicken(world);
|
2013-07-13 03:48:08 -07:00
|
|
|
spawnEntity(player.posX, player.posY + 1, player.posZ, chicken, world, player);
|
2013-08-16 09:30:56 -07:00
|
|
|
entity.mountEntity(chicken);*/
|
2013-07-11 00:07:02 -07:00
|
|
|
//healPlayer(player);
|
|
|
|
|
//removeChunk(world, player.posX, player.posZ);
|
|
|
|
|
return stack;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void clearInventoryExeptHotbar (EntityPlayer player)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 9; i < 36; i++)
|
|
|
|
|
player.inventory.mainInventory[i] = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float clickX, float clickY, float clickZ)
|
|
|
|
|
{
|
|
|
|
|
EntityLightningBolt entity = new EntityLightningBolt(world, x, y, z);
|
2013-04-17 22:52:40 -07:00
|
|
|
world.spawnEntityInWorld(entity);
|
|
|
|
|
entity = new EntityLightningBolt(world, x-3, y+4, z-3);
|
|
|
|
|
world.spawnEntityInWorld(entity);
|
|
|
|
|
entity = new EntityLightningBolt(world, x-3, y+4, z+3);
|
|
|
|
|
world.spawnEntityInWorld(entity);
|
|
|
|
|
entity = new EntityLightningBolt(world, x+3, y+4, z-3);
|
|
|
|
|
world.spawnEntityInWorld(entity);
|
|
|
|
|
entity = new EntityLightningBolt(world, x+3, y+4, z+3);
|
|
|
|
|
world.spawnEntityInWorld(entity);
|
|
|
|
|
return false;
|
|
|
|
|
}*/
|
2013-03-20 08:52:42 -07:00
|
|
|
|
2013-07-11 00:07:02 -07:00
|
|
|
public static void healPlayer (EntityPlayer player)
|
|
|
|
|
{
|
2013-09-08 20:37:41 -07:00
|
|
|
player.setHealth(50);
|
2013-07-11 00:07:02 -07:00
|
|
|
}
|
2013-03-20 08:52:42 -07:00
|
|
|
|
2013-07-11 00:07:02 -07:00
|
|
|
public static void spawnItem (double x, double y, double z, ItemStack stack, World world)
|
|
|
|
|
{
|
|
|
|
|
if (!world.isRemote)
|
|
|
|
|
{
|
|
|
|
|
EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 0.5D, z + 0.5D, stack);
|
|
|
|
|
world.spawnEntityInWorld(entityitem);
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-03-20 08:52:42 -07:00
|
|
|
|
2013-07-11 00:07:02 -07:00
|
|
|
public static void spawnEntity (double x, double y, double z, Entity entity, World world, EntityPlayer player)
|
|
|
|
|
{
|
|
|
|
|
if (!world.isRemote)
|
|
|
|
|
{
|
|
|
|
|
entity.setPosition(x, y, z);
|
|
|
|
|
entity.setAngles(player.cameraYaw, player.cameraYaw);
|
|
|
|
|
//((BlueSlime) entity).setSlimeSize(8);
|
2013-07-25 03:18:26 -07:00
|
|
|
//((EntityLiving) entity).initCreature();
|
2013-07-11 00:07:02 -07:00
|
|
|
world.spawnEntityInWorld(entity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void removeChunk (World world, double dx, double dz)
|
|
|
|
|
{
|
|
|
|
|
for (int x = 0; x < 16; x++)
|
|
|
|
|
{
|
|
|
|
|
for (int z = 0; z < 16; z++)
|
|
|
|
|
{
|
|
|
|
|
for (int y = 0; y < 128; y++)
|
|
|
|
|
{
|
|
|
|
|
world.setBlock((int) (x + dx), y, (int) (z + dz), 0, 0, 3);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-03-20 08:52:42 -07:00
|
|
|
}
|