本文整理汇总了Java中net.minecraft.util.EnumMovingObjectType.ENTITY属性的典型用法代码示例。如果您正苦于以下问题:Java EnumMovingObjectType.ENTITY属性的具体用法?Java EnumMovingObjectType.ENTITY怎么用?Java EnumMovingObjectType.ENTITY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.minecraft.util.EnumMovingObjectType
的用法示例。
在下文中一共展示了EnumMovingObjectType.ENTITY属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tickEnd
@Override
public void tickEnd(EnumSet<TickType> type, Object... tickData)
{
if (!type.contains(TickType.PLAYER)) return;
EntityPlayer entityPlayer = (EntityPlayer) tickData[0];
if (entityPlayer != null)
{
//If we JUST swung an Item
if (entityPlayer.swingProgressInt == 1)
{
ItemStack mainhand = entityPlayer.getCurrentEquippedItem();
if (mainhand != null && mainhand.getItem() instanceof IExtendedReachItem)
{
float extendedReach = ((IExtendedReachItem) mainhand.getItem()).getReachModifierInBlocks(mainhand);
if(extendedReach > 0)
{
MovingObjectPosition mouseOver = ExtendedReachHelper.getMouseOver(0, extendedReach + 4);
if (mouseOver != null && mouseOver.typeOfHit == EnumMovingObjectType.ENTITY)
{
Entity target = mouseOver.entityHit;
if (target instanceof EntityLiving && target != entityPlayer)
{
if (target.hurtResistantTime != ((EntityLiving) target).maxHurtResistantTime)
{
FMLClientHandler.instance().getClient().playerController.attackEntity(entityPlayer, target);
}
}
}
}
}
}
}
}
示例2: onImpact
private void onImpact(MovingObjectPosition mop) {
if (mop.typeOfHit == EnumMovingObjectType.ENTITY && mop.entityHit != null) {
if (mop.entityHit == shootingEntity) return;
this.onImpact(mop.entityHit);
} else if (mop.typeOfHit == EnumMovingObjectType.TILE) {
this.groundImpact(mop.sideHit);
}
}
示例3: onItemRightClick
@Override
public ItemStack onItemRightClick(ItemStack item, World world,
EntityPlayer player)
{
Entity entity = null;
player.swingItem();
MovingObjectPosition mop = player.rayTrace(100, 1F);
if(mop != null){
if(mop.typeOfHit == EnumMovingObjectType.ENTITY){
if(mop.entityHit != null){
entity = mop.entityHit;
}
}
}
if(entity instanceof EntityRobot){
EntityRobot robot = (EntityRobot) entity;
boolean destroy = false;
if(robot.getOwner() == null){
destroy = true;
}
else{
if(robot.getOwner().equals(player.username)){
destroy = true;
}
}
if(destroy){
robot.dropItem(robot.getDropItemId(), 1);
robot.setDead();
for(int i = 0; i < 250; i ++){
WorldUtils.spawnPaticleWithOffset(robot.worldObj, "happyVillager", robot.posX, robot.posY + 1, robot.posZ, 0, 1, 0, 0.5, 2, 0.5);
}
for(int i = 0; i < 10; i ++){
WorldUtils.spawnPaticleWithOffset(robot.worldObj, "largeexplode", robot.posX, robot.posY + 1, robot.posZ, 1, 0, 0, 0.5, 2, 0.5);
}
}
}
return item;
}
示例4: func_71402_c
private void func_71402_c(int p_71402_1_) {
if(p_71402_1_ != 0 || this.field_71429_W <= 0) {
if(p_71402_1_ == 0) {
this.field_71439_g.func_71038_i();
}
if(p_71402_1_ == 1) {
this.field_71467_ac = 4;
}
boolean var2 = true;
ItemStack var3 = this.field_71439_g.field_71071_by.func_70448_g();
if(this.field_71476_x == null) {
if(p_71402_1_ == 0 && this.field_71442_b.func_78762_g()) {
this.field_71429_W = 10;
}
} else if(this.field_71476_x.field_72313_a == EnumMovingObjectType.ENTITY) {
if(p_71402_1_ == 0) {
this.field_71442_b.func_78764_a(this.field_71439_g, this.field_71476_x.field_72308_g);
}
if(p_71402_1_ == 1 && this.field_71442_b.func_78768_b(this.field_71439_g, this.field_71476_x.field_72308_g)) {
var2 = false;
}
} else if(this.field_71476_x.field_72313_a == EnumMovingObjectType.TILE) {
int var4 = this.field_71476_x.field_72311_b;
int var5 = this.field_71476_x.field_72312_c;
int var6 = this.field_71476_x.field_72309_d;
int var7 = this.field_71476_x.field_72310_e;
if(p_71402_1_ == 0) {
this.field_71442_b.func_78743_b(var4, var5, var6, this.field_71476_x.field_72310_e);
} else {
int var8 = var3 != null?var3.field_77994_a:0;
if(this.field_71442_b.func_78760_a(this.field_71439_g, this.field_71441_e, var3, var4, var5, var6, var7, this.field_71476_x.field_72307_f)) {
var2 = false;
this.field_71439_g.func_71038_i();
}
if(var3 == null) {
return;
}
if(var3.field_77994_a == 0) {
this.field_71439_g.field_71071_by.field_70462_a[this.field_71439_g.field_71071_by.field_70461_c] = null;
} else if(var3.field_77994_a != var8 || this.field_71442_b.func_78758_h()) {
this.field_71460_t.field_78516_c.func_78444_b();
}
}
}
if(var2 && p_71402_1_ == 1) {
ItemStack var9 = this.field_71439_g.field_71071_by.func_70448_g();
if(var9 != null && this.field_71442_b.func_78769_a(this.field_71439_g, this.field_71441_e, var9)) {
this.field_71460_t.field_78516_c.func_78445_c();
}
}
}
}
示例5: func_71397_M
private void func_71397_M() {
if(this.field_71476_x != null) {
boolean var1 = this.field_71439_g.field_71075_bZ.field_75098_d;
int var3 = 0;
boolean var4 = false;
int var2;
int var5;
if(this.field_71476_x.field_72313_a == EnumMovingObjectType.TILE) {
var5 = this.field_71476_x.field_72311_b;
int var6 = this.field_71476_x.field_72312_c;
int var7 = this.field_71476_x.field_72309_d;
Block var8 = Block.field_71973_m[this.field_71441_e.func_72798_a(var5, var6, var7)];
if(var8 == null) {
return;
}
var2 = var8.func_71922_a(this.field_71441_e, var5, var6, var7);
if(var2 == 0) {
return;
}
var4 = Item.field_77698_e[var2].func_77614_k();
int var9 = var2 < 256 && !Block.field_71973_m[var8.field_71990_ca].func_82505_u_()?var2:var8.field_71990_ca;
var3 = Block.field_71973_m[var9].func_71873_h(this.field_71441_e, var5, var6, var7);
} else {
if(this.field_71476_x.field_72313_a != EnumMovingObjectType.ENTITY || this.field_71476_x.field_72308_g == null || !var1) {
return;
}
if(this.field_71476_x.field_72308_g instanceof EntityPainting) {
var2 = Item.field_77780_as.field_77779_bT;
} else if(this.field_71476_x.field_72308_g instanceof EntityLeashKnot) {
var2 = Item.field_111214_ch.field_77779_bT;
} else if(this.field_71476_x.field_72308_g instanceof EntityItemFrame) {
EntityItemFrame var10 = (EntityItemFrame)this.field_71476_x.field_72308_g;
if(var10.func_82335_i() == null) {
var2 = Item.field_82802_bI.field_77779_bT;
} else {
var2 = var10.func_82335_i().field_77993_c;
var3 = var10.func_82335_i().func_77960_j();
var4 = true;
}
} else if(this.field_71476_x.field_72308_g instanceof EntityMinecart) {
EntityMinecart var11 = (EntityMinecart)this.field_71476_x.field_72308_g;
if(var11.func_94087_l() == 2) {
var2 = Item.field_77763_aO.field_77779_bT;
} else if(var11.func_94087_l() == 1) {
var2 = Item.field_77762_aN.field_77779_bT;
} else if(var11.func_94087_l() == 3) {
var2 = Item.field_94582_cb.field_77779_bT;
} else if(var11.func_94087_l() == 5) {
var2 = Item.field_96600_cc.field_77779_bT;
} else {
var2 = Item.field_77773_az.field_77779_bT;
}
} else if(this.field_71476_x.field_72308_g instanceof EntityBoat) {
var2 = Item.field_77769_aE.field_77779_bT;
} else {
var2 = Item.field_77815_bC.field_77779_bT;
var3 = EntityList.func_75619_a(this.field_71476_x.field_72308_g);
var4 = true;
if(var3 <= 0 || !EntityList.field_75627_a.containsKey(Integer.valueOf(var3))) {
return;
}
}
}
this.field_71439_g.field_71071_by.func_70433_a(var2, var3, var4, var1);
if(var1) {
var5 = this.field_71439_g.field_71069_bz.field_75151_b.size() - 9 + this.field_71439_g.field_71071_by.field_70461_c;
this.field_71442_b.func_78761_a(this.field_71439_g.field_71071_by.func_70301_a(this.field_71439_g.field_71071_by.field_70461_c), var5);
}
}
}
示例6: MovingObjectPosition
public MovingObjectPosition(Entity p_i2304_1_) {
this.field_72313_a = EnumMovingObjectType.ENTITY;
this.field_72308_g = p_i2304_1_;
this.field_72307_f = p_i2304_1_.field_70170_p.func_82732_R().func_72345_a(p_i2304_1_.field_70165_t, p_i2304_1_.field_70163_u, p_i2304_1_.field_70161_v);
}
示例7: onPickBlock
/**
* Called when a player uses 'pick block', calls new Entity and Block hooks.
*/
public static boolean onPickBlock(MovingObjectPosition target, EntityPlayer player, World world)
{
ItemStack result = null;
boolean isCreative = player.capabilities.isCreativeMode;
if (target.typeOfHit == EnumMovingObjectType.TILE)
{
int x = target.blockX;
int y = target.blockY;
int z = target.blockZ;
Block var8 = Block.blocksList[world.getBlockId(x, y, z)];
if (var8 == null)
{
return false;
}
result = var8.getPickBlock(target, world, x, y, z);
}
else
{
if (target.typeOfHit != EnumMovingObjectType.ENTITY || target.entityHit == null || !isCreative)
{
return false;
}
result = target.entityHit.getPickedResult(target);
}
if (result == null)
{
return false;
}
for (int x = 0; x < 9; x++)
{
ItemStack stack = player.inventory.getStackInSlot(x);
if (stack != null && stack.isItemEqual(result) && ItemStack.areItemStackTagsEqual(stack, result))
{
player.inventory.currentItem = x;
return true;
}
}
if (!isCreative)
{
return false;
}
int slot = player.inventory.getFirstEmptyStack();
if (slot < 0 || slot >= 9)
{
slot = player.inventory.currentItem;
}
player.inventory.setInventorySlotContents(slot, result);
player.inventory.currentItem = slot;
return true;
}
示例8: onImpact
private void onImpact(MovingObjectPosition mop) {
if (mop.typeOfHit == EnumMovingObjectType.ENTITY && mop.entityHit != null) {
if (mop.entityHit == shootingEntity) return;
this.onImpact(mop.entityHit);
}
}
示例9: onItemRightClick
public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player)
{
if(!item.hasTagCompound()){
this.onCreated(item, world, player);
}
item.stackTagCompound.setBoolean("Fireing", true);
player.setItemInUse(item, 7200);
MovingObjectPosition mop = player.rayTrace(150, 1F);
if(mop == null || (mop.typeOfHit == EnumMovingObjectType.ENTITY && mop.entityHit == null))
{
player.sendChatToPlayer("Can't fire phaser at nothing");
}
else if(mop.typeOfHit == EnumMovingObjectType.ENTITY)
{
for(int i = 0; i < 10; i ++){
WorldUtils.spawnPaticleWithOffset(player.worldObj, "largeexplode", mop.entityHit.posX + 0.5, mop.entityHit.posY + 0.5, mop.entityHit.posZ + 0.5, 1, 0, 0, 1, 1, 1);
}
}
else
{
ItemStack tempStack = new ItemStack(world.getBlockId(mop.blockX, mop.blockY, mop.blockZ), 1, world.getBlockMetadata(mop.blockX, mop.blockY, mop.blockZ));
if(tempStack.getItem() != null)
{
for(int i = 0; i < 10; i ++){
WorldUtils.spawnPaticleWithOffset(player.worldObj, "largeexplode", mop.blockX + 0.5, mop.blockY + 0.5, mop.blockZ + 0.5, 1, 0, 0, 1, 1, 1);
}
world.createExplosion(null, mop.blockX, mop.blockY, mop.blockZ, 0, true);
if(world.getBlockTileEntity(mop.blockX, mop.blockY, mop.blockZ) != null){
world.removeBlockTileEntity(mop.blockX, mop.blockY, mop.blockZ);
}
world.setBlockToAir(mop.blockX, mop.blockY, mop.blockZ);
}
else
{
for(int i = 0; i < 10; i ++){
WorldUtils.spawnPaticleWithOffset(player.worldObj, "largeexplode", mop.blockX + 0.5, mop.blockY + 0.5, mop.blockZ + 0.5, 1, 0, 0, 1, 1, 1);
}
}
}
return super.onItemRightClick(item, world, player);
}
示例10: onUsingItemTick
@Override
public void onUsingItemTick(ItemStack stack, EntityPlayer player, int count)
{
World world = player.worldObj;
if(!world.isRemote){
if(stack.stackTagCompound.getBoolean("Fireing")){
MovingObjectPosition mop = player.rayTrace(150, 1F);
if(mop == null || (mop.typeOfHit == EnumMovingObjectType.ENTITY && mop.entityHit == null))
{
player.sendChatToPlayer("Can't fire phaser at nothing");
}
else if(mop.typeOfHit == EnumMovingObjectType.ENTITY)
{
for(int i = 0; i < 10; i ++){
WorldUtils.spawnPaticleWithOffset(player.worldObj, "largeexplode", mop.entityHit.posX + 0.5, mop.entityHit.posY + 0.5, mop.entityHit.posZ + 0.5, 1, 0, 0, 1, 1, 1);
}
}
else
{
ItemStack tempStack = new ItemStack(world.getBlockId(mop.blockX, mop.blockY, mop.blockZ), 1, world.getBlockMetadata(mop.blockX, mop.blockY, mop.blockZ));
if(tempStack.getItem() != null)
{
for(int i = 0; i < 10; i ++){
WorldUtils.spawnPaticleWithOffset(player.worldObj, "largeexplode", mop.blockX + 0.5, mop.blockY + 0.5, mop.blockZ + 0.5, 1, 0, 0, 1, 1, 1);
}
world.createExplosion(null, mop.blockX, mop.blockY, mop.blockZ, 0, true);
if(world.getBlockTileEntity(mop.blockX, mop.blockY, mop.blockZ) != null){
world.removeBlockTileEntity(mop.blockX, mop.blockY, mop.blockZ);
}
world.setBlockToAir(mop.blockX, mop.blockY, mop.blockZ);
}
else
{
for(int i = 0; i < 10; i ++){
WorldUtils.spawnPaticleWithOffset(player.worldObj, "largeexplode", mop.blockX + 0.5, mop.blockY + 0.5, mop.blockZ + 0.5, 1, 0, 0, 1, 1, 1);
}
}
}
}
}
stack.stackTagCompound.setBoolean("Fireing", false);
}