use of micdoodle8.mods.galacticraft.planets.asteroids.entities.EntityGrapple in project Galacticraft by micdoodle8.
the class PacketSimpleAsteroids method handleClientSide.
@SideOnly(Side.CLIENT)
@Override
public void handleClientSide(EntityPlayer player) {
EntityPlayerSP playerBaseClient = null;
if (player instanceof EntityPlayerSP) {
playerBaseClient = (EntityPlayerSP) player;
}
TileEntity tile;
switch(this.type) {
case C_TELEPAD_SEND:
Entity entity = playerBaseClient.worldObj.getEntityByID((Integer) this.data.get(1));
if (entity != null && entity instanceof EntityLivingBase) {
BlockVec3 pos = (BlockVec3) this.data.get(0);
entity.setPosition(pos.x + 0.5, pos.y + 2.2, pos.z + 0.5);
}
break;
case C_UPDATE_GRAPPLE_POS:
entity = playerBaseClient.worldObj.getEntityByID((Integer) this.data.get(0));
if (entity != null && entity instanceof EntityGrapple) {
Vector3 vec = (Vector3) this.data.get(1);
entity.setPosition(vec.x, vec.y, vec.z);
}
break;
default:
break;
}
}
use of micdoodle8.mods.galacticraft.planets.asteroids.entities.EntityGrapple in project Galacticraft by micdoodle8.
the class ItemGrappleHook method onPlayerStoppedUsing.
@Override
public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4) {
boolean flag = par3EntityPlayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, par1ItemStack) > 0;
if (flag || par3EntityPlayer.inventory.hasItem(Items.string)) {
EntityGrapple grapple = new EntityGrapple(par2World, par3EntityPlayer, 2.0F);
par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 1.0F, 1.0F / (Item.itemRand.nextFloat() * 0.4F + 1.2F) + 0.5F);
if (!par2World.isRemote) {
par2World.spawnEntityInWorld(grapple);
}
par1ItemStack.damageItem(1, par3EntityPlayer);
grapple.canBePickedUp = par3EntityPlayer.capabilities.isCreativeMode ? 2 : 1;
if (!par3EntityPlayer.capabilities.isCreativeMode) {
par3EntityPlayer.inventory.consumeInventoryItem(Items.string);
}
} else if (par2World.isRemote) {
par3EntityPlayer.addChatMessage(new ChatComponentText(GCCoreUtil.translate("gui.message.grapple.fail")));
}
}
Aggregations