-
Notifications
You must be signed in to change notification settings - Fork 755
/
XinStick.java
107 lines (96 loc) · 3.42 KB
/
XinStick.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
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;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
import bastion.entity.WoodMinecartEntity;
/*
* mDiyo's development testing item
* Does everything on right-click!
*/
public class XinStick extends Item
{
public XinStick(int id)
{
super(id);
setCreativeTab(CreativeTabs.tabMisc);
}
public Icon getIconFromDamage (int par1)
{
return Item.arrow.getIconFromDamage(par1);
}
@Override
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
{
//clearInventoryExeptHotbar(player);
WoodMinecartEntity entity = new WoodMinecartEntity(world);
//entity.setLeader(player);
//entity.setCustomNameTag("Cutie");
spawnEntity(player.posX, player.posY + 1, player.posZ, entity, world, player);
/*EntityChicken chicken = new EntityChicken(world);
spawnEntity(player.posX, player.posY + 1, player.posZ, chicken, world, player);
entity.mountEntity(chicken);*/
//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);
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;
}*/
public static void healPlayer (EntityPlayer player)
{
player.setHealth(50);
}
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);
}
}
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);
//((EntityLiving) entity).initCreature();
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);
}
}
}
}
}