本文整理匯總了Java中net.minecraft.util.MovingObjectPosition.MovingObjectType.ENTITY屬性的典型用法代碼示例。如果您正苦於以下問題:Java MovingObjectType.ENTITY屬性的具體用法?Java MovingObjectType.ENTITY怎麽用?Java MovingObjectType.ENTITY使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類net.minecraft.util.MovingObjectPosition.MovingObjectType
的用法示例。
在下文中一共展示了MovingObjectType.ENTITY屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: impactWasting
private void impactWasting(MovingObjectPosition mop, boolean enhanced) {
Entity livingEntity = mop.entityHit;
double x;
double y;
double z;
if(mop.typeOfHit == MovingObjectType.ENTITY) {
x = livingEntity.posX;
y = livingEntity.posY;
z = livingEntity.posZ;
} else {
x = (double)mop.blockX;
y = (double)mop.blockY;
z = (double)mop.blockZ;
}
explodeWasting(super.worldObj, x, y, z, livingEntity, super.boundingBox, enhanced);
}
示例2: onImpact
@Override
protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
{
if(!worldObj.isRemote)
if(par1MovingObjectPosition.typeOfHit == MovingObjectType.ENTITY)
{
if(par1MovingObjectPosition.entityHit instanceof EntityPlayer)
if(((EntityPlayer)par1MovingObjectPosition.entityHit).capabilities.isCreativeMode || (EntityLivingBase)par1MovingObjectPosition.entityHit == getThrower())
return;
if(par1MovingObjectPosition.entityHit instanceof EntityLivingBase)
{
((EntityLivingBase) par1MovingObjectPosition.entityHit).attackEntityFrom(DamageSource.generic, 1F);
((EntityLivingBase) par1MovingObjectPosition.entityHit).addPotionEffect(new PotionEffect(Potion.weakness.id, 500, 2));
((EntityLivingBase) par1MovingObjectPosition.entityHit).addPotionEffect(new PotionEffect(Potion.confusion.id, 500, 2));
((EntityLivingBase) par1MovingObjectPosition.entityHit).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 500, 2));
setDead();
}
}
}
示例3: runAutoTool
public void runAutoTool(boolean proactive) {
// proactive means we're doing this before the keybinding is even logged yet.
// currently mining? and not using swap command?
if (swappedInventoryState == 0 && (proactive || mc.gameSettings.keyBindAttack.isKeyDown()) && mc.objectMouseOver != null) {
// get the block being targetted
if (!mc.playerController.isInCreativeMode() && ControlPackOptions.booleanOptions.get(ControlPackEnumOptions.AUTOTOOL) && mc.objectMouseOver.typeOfHit == MovingObjectType.BLOCK) {
Block block = mc.world.getBlockState(mc.objectMouseOver.getBlockPos()).getBlock();
if (block != null) {
ensureCorrectToolSelected(block);
}
}
else if (ControlPackOptions.booleanOptions.get(ControlPackEnumOptions.AUTOSWORD) && (mc.objectMouseOver.typeOfHit == MovingObjectType.ENTITY && mc.objectMouseOver.entityHit instanceof EntityLivingBase)) {
ensureSwordSelected();
}
// fyi change item: player.inventory.changeCurrentItem(k);, or player.inventory.currentItem = i;
// mc.objectMouseOver
// objectMouseOver.typeOfHit == EnumMovingObjectType.TILE
// objectMouseOver.typeOfHit == EnumMovingObjectType.ENTITY
// objectMouseOver.blockX,Y,Z
// world.getBlockId(i,j,k)
// Block.blocksList[id]
}
}
示例4: onImpact
@Override
protected void onImpact(MovingObjectPosition mop) {
if (!worldObj.isRemote) {
if (mop.typeOfHit == MovingObjectType.ENTITY) {
Entity entity = mop.entityHit;
if (entity instanceof EntityLivingBase && !affectedEntities.contains(entity.getEntityId()) && entity != getThrower()) {
affectedEntities.add(entity.getEntityId());
if (entity.attackEntityFrom(DamageUtils.causeIndirectSwordDamage(this, getThrower()), damage)) {
WorldUtils.playSoundAtEntity(entity, Sounds.HURT_FLESH, 0.4F, 0.5F);
if (entity instanceof EntityLivingBase) {
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.weakness.id, 60));
}
}
}
} else {
Block block = worldObj.getBlockState(mop.getBlockPos()).getBlock();
if (block.getMaterial().blocksMovement()) {
setDead();
}
}
}
}
示例5: impactHitchcock
private void impactHitchcock(MovingObjectPosition mop) {
if(mop.typeOfHit == MovingObjectType.ENTITY && mop.entityHit instanceof EntityLivingBase) {
EntityLivingBase var7 = (EntityLivingBase)mop.entityHit;
int var6 = super.worldObj.rand.nextInt(2) + 3;
for(int i = 0; i < var6; ++i) {
EntityOwl owl = new EntityOwl(super.worldObj);
owl.setLocationAndAngles(var7.posX - 2.0D + (double)super.worldObj.rand.nextInt(5), var7.posY + (double)var7.height + 1.0D + (double)super.worldObj.rand.nextInt(2), var7.posZ - 2.0D + (double)super.worldObj.rand.nextInt(5), 0.0F, 0.0F);
owl.setAttackTarget(var7);
owl.setTimeToLive(400);
super.worldObj.spawnEntityInWorld(owl);
ParticleEffect.PORTAL.send(SoundEffect.MOB_ENDERMEN_PORTAL, owl, 1.0D, 1.0D, 16);
}
} else {
EntityItem itemEntity = null;
if(mop != null) {
ItemStack newBrewStack = Witchery.Items.GENERIC.itemBrewOfHitchcock.createStack();
switch(EntityWitchProjectile.NamelessClass2036201851.$SwitchMap$net$minecraft$util$MovingObjectPosition$MovingObjectType[mop.typeOfHit.ordinal()]) {
case 1:
itemEntity = new EntityItem(super.worldObj, (double)mop.blockX + 0.5D, (double)(mop.blockY + (mop.sideHit == 0?-1:1)) + 0.5D, (double)mop.blockZ + 0.5D, newBrewStack);
break;
case 2:
itemEntity = new EntityItem(super.worldObj, mop.entityHit.posX, mop.entityHit.posY, mop.entityHit.posZ, newBrewStack);
}
}
this.skipFX = true;
if(itemEntity != null) {
super.worldObj.spawnEntityInWorld(itemEntity);
}
}
}
示例6: impactQuicklime
private void impactQuicklime(MovingObjectPosition mop) {
if(mop.typeOfHit == MovingObjectType.ENTITY) {
if(mop.entityHit instanceof EntityLivingBase) {
EntityLivingBase itemEntity1 = (EntityLivingBase)mop.entityHit;
if(!itemEntity1.isPotionActive(Potion.blindness)) {
itemEntity1.addPotionEffect(new PotionEffect(Potion.blindness.id, 60, 0));
}
float newBrewStack1 = mop.entityHit instanceof EntitySlime?4.0F:(itemEntity1.getHealth() == itemEntity1.getMaxHealth()?0.5F:0.1F);
itemEntity1.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), newBrewStack1);
}
this.skipFX = true;
} else {
EntityItem itemEntity = null;
if(mop != null) {
ItemStack newBrewStack = Witchery.Items.GENERIC.itemQuicklime.createStack();
switch(EntityWitchProjectile.NamelessClass2036201851.$SwitchMap$net$minecraft$util$MovingObjectPosition$MovingObjectType[mop.typeOfHit.ordinal()]) {
case 1:
itemEntity = new EntityItem(super.worldObj, (double)mop.blockX + 0.5D, (double)(mop.blockY + (mop.sideHit == 0?-1:1)) + 0.5D, (double)mop.blockZ + 0.5D, newBrewStack);
break;
case 2:
itemEntity = new EntityItem(super.worldObj, mop.entityHit.posX, mop.entityHit.posY, mop.entityHit.posZ, newBrewStack);
}
}
this.skipFX = true;
if(itemEntity != null) {
super.worldObj.spawnEntityInWorld(itemEntity);
}
}
}
示例7: rayTraceCuboid
public MovingObjectPosition rayTraceCuboid(Vector3 start, Vector3 end, Cuboid6 cuboid, Entity e)
{
MovingObjectPosition mop = rayTraceCuboid(start, end, cuboid);
if(mop != null)
{
mop.typeOfHit = MovingObjectType.ENTITY;
mop.entityHit = e;
}
return mop;
}
示例8: getPlayerLookingAtEntity
public Entity getPlayerLookingAtEntity(EntityPlayerMP player, float reach)
{
Vec3 vec3d = Vec3.createVectorHelper(player.posX, (player.posY + 1.6200000000000001D) - player.yOffset, player.posZ);
Vec3 vec3d1 = player.getLook(1.0F);
Vec3 vec3d2 = vec3d.addVector(vec3d1.xCoord * reach, vec3d1.yCoord * reach, vec3d1.zCoord * reach);
MovingObjectPosition hit = player.worldObj.rayTraceBlocks(vec3d, vec3d2);
if(hit == null || hit.typeOfHit != MovingObjectType.ENTITY)
{
return null;
}
return hit.entityHit;
}
示例9: onUpdate
@Override
public void onUpdate() {
if (Minecraft.getMinecraft().objectMouseOver != null &&
Minecraft.getMinecraft().objectMouseOver.typeOfHit == MovingObjectType.ENTITY &&
Minecraft.getMinecraft().objectMouseOver.entityHit instanceof EntityLivingBase) {
updateMS();
boolean yesCheatMode = WurstClient.INSTANCE.mods.getModByClass(YesCheatMod.class).isActive();
if (yesCheatMode &&
hasTimePassedS(WurstClient.INSTANCE.mods.getModByClass(KillauraMod.class).yesCheatSpeed) ||
!yesCheatMode &&
hasTimePassedS(WurstClient.INSTANCE.mods.getModByClass(KillauraMod.class).normalSpeed)) {
EntityLivingBase en = (EntityLivingBase) Minecraft.getMinecraft().objectMouseOver.entityHit;
if ((yesCheatMode && Minecraft.getMinecraft().thePlayer.getDistanceToEntity(en) <=
WurstClient.INSTANCE.mods.getModByClass(KillauraMod.class).yesCheatRange || !yesCheatMode &&
Minecraft.getMinecraft().thePlayer.getDistanceToEntity(en) <=
WurstClient.INSTANCE.mods.getModByClass(KillauraMod.class).normalRange) &&
EntityUtils.isCorrectEntity(en, true)) {
if (WurstClient.INSTANCE.mods.getModByClass(AutoSwordMod.class).isActive()) AutoSwordMod.setSlot();
CriticalsMod.doCritical();
WurstClient.INSTANCE.mods.getModByClass(BlockHitMod.class).doBlock();
Minecraft.getMinecraft().thePlayer.swingItem();
Minecraft.getMinecraft().playerController.attackEntity(Minecraft.getMinecraft().thePlayer, en);
updateLastMS();
}
}
}
}
示例10: renderOverLay
@SubscribeEvent
public void renderOverLay(RenderGameOverlayEvent.Pre event)
{
MovingObjectPosition movingObjectPosition = Minecraft.getMinecraft().objectMouseOver;
if(movingObjectPosition != null && movingObjectPosition.typeOfHit == MovingObjectType.ENTITY)
{
if(movingObjectPosition.entityHit instanceof EntityMinecartTEBase)
{
EntityMinecartTEBase minecartTEBase = (EntityMinecartTEBase)movingObjectPosition.entityHit;
minecartTEBase.setClientNeedy(true);
minecartTEBase.markDirty();
}
}
}
示例11: set
public void set(World _world, EntityPlayer _player, MovingObjectPosition _mop, EntityLivingBase viewEntity, double partialTicks) {
this.world = _world;
this.player = _player;
this.mop = _mop;
if (this.mop.typeOfHit == MovingObjectType.BLOCK){
this.block = world.getBlock(_mop.blockX, _mop.blockY, _mop.blockZ);
this.metadata = world.getBlockMetadata(_mop.blockX, _mop.blockY, _mop.blockZ);
this.tileEntity = world.getTileEntity(_mop.blockX, _mop.blockY, _mop.blockZ);
this.entity = null;
this.blockID = Block.getIdFromBlock(this.block);
this.blockResource = GameData.getBlockRegistry().getNameForObject(this.block);
try{ this.stack = new ItemStack(this.block, 1, this.metadata); } catch (Exception e) {}
} else if (this.mop.typeOfHit == MovingObjectType.ENTITY){
this.block = null;
this.metadata = -1;
this.tileEntity = null;
this.stack = null;
this.entity = _mop.entityHit;
}
if (viewEntity != null){
double px = viewEntity.lastTickPosX + (viewEntity.posX - viewEntity.lastTickPosX) * partialTicks;
double py = viewEntity.lastTickPosY + (viewEntity.posY - viewEntity.lastTickPosY) * partialTicks;
double pz = viewEntity.lastTickPosZ + (viewEntity.posZ - viewEntity.lastTickPosZ) * partialTicks;
this.renderingvec = Vec3.createVectorHelper(_mop.blockX - px, _mop.blockY - py, _mop.blockZ - pz);
this.partialFrame = partialTicks;
}
}
示例12: onClick
@Override
public void onClick(EventOnClick event){
if(event.getButton() == 0 && invoker.isOnGround() && !invoker.isInWater() && ((invoker.getObjectMouseOver() != null && invoker.getObjectMouseOver().typeOfHit == MovingObjectType.ENTITY) || (event.isAutoClick() && Resilience.getInstance().getValues().killAuraEnabled))){
invoker.setMotionY(0.290000000);
invoker.setFallDistance(0.289F);
invoker.setOnGround(false);
}
}
示例13: onImpact
@Override
public void onImpact(MovingObjectPosition position)
{
if (this.ticksInAir >= 3 && !worldObj.isRemote)
{
float speed = calcSpeed();
BlockPos pos = position.getBlockPos();
if (position.typeOfHit == MovingObjectType.BLOCK)
{
// Hit a block
if (speed >= VELOCITY_COST) {
// Destroys the block and explodes
worldObj.destroyBlock(pos, false);
this.setSpeed(speed - VELOCITY_COST);
}
else {
this.setDead();
}
}
else if (position.typeOfHit == MovingObjectType.ENTITY)
{
// Hit an entity
Entity entityHit = position.entityHit;
entityHit.motionX += this.motionX;
entityHit.motionY += this.motionY;
entityHit.motionZ += this.motionZ;
}
// Blows up
worldObj.createExplosion(this, pos.getX(), pos.getY(), pos.getZ(), speed / 2, true);
}
}
示例14: onKeyInput
@SubscribeEvent
public void onKeyInput(KeyInputEvent event) {
if(WikiLink.keyBinding.isPressed()) {
Minecraft mc = Minecraft.getMinecraft();
Object topic = null;
if(mc.inGameHasFocus) {
if(mc.pointedEntity != null) {
if(mc.pointedEntity instanceof EntityItem) {
topic = ((EntityItem) mc.pointedEntity).getEntityItem().copy();
((ItemStack) topic).stackSize = 1;
} else {
topic = mc.pointedEntity;
}
} else if(mc.objectMouseOver != null) {
MovingObjectPosition mop = mc.objectMouseOver;
if(mop.typeOfHit == MovingObjectType.BLOCK) {
Block block = mc.theWorld.getBlock(mop.blockX, mop.blockY, mop.blockZ);
topic = block.getPickBlock(mop, mc.theWorld, mop.blockX, mop.blockY, mop.blockZ);
((ItemStack) topic).stackSize = 1;
} else if(mop.typeOfHit == MovingObjectType.ENTITY) {
if(mop.entityHit instanceof EntityItem) {
topic = ((EntityItem) mop.entityHit).getEntityItem().copy();
((ItemStack) topic).stackSize = 1;
} else {
topic = mop.entityHit;
}
}
}
}
if(topic != null) {
mc.displayGuiScreen(new GuiWikiLinkMenu(topic));
}
}
}
示例15: onUse
@Override
public void onUse(World world, EntityPlayer player, IPlayerSession session, ItemStack stack, int boost, int cost) {
if (session.hasEnoughMana(cost())) {
MovingObjectPosition mop = SimpleUtil.rayTrace(player, world, 70 + (boost * 2));
if (mop != null) {
int oldX = MathHelper.floor_double(player.posX), oldY = MathHelper.floor_double(player.posY), oldZ = MathHelper.floor_double(player.posZ);
int newX = MathHelper.floor_double(player.posX), newY = MathHelper.floor_double(player.posY), newZ = MathHelper.floor_double(player.posZ);
boolean teleport = false;
if (mop.typeOfHit == MovingObjectType.BLOCK) {
newX = mop.blockX;
newY = mop.blockY;
newZ = mop.blockZ;
Block blk = world.getBlock(newX, newY, newZ);
if (blk != null && !world.isAirBlock(newX, newY, newZ))
teleport = true;
} else if (mop.typeOfHit == MovingObjectType.ENTITY) {
newX = MathHelper.floor_double(mop.entityHit.posX);
newY = MathHelper.floor_double(mop.entityHit.posY);
newZ = MathHelper.floor_double(mop.entityHit.posZ);
teleport = true;
}
if (teleport) {
teleportTo(player, newX, newY, newZ);
if (MathHelper.floor_double(player.posX) != oldX || MathHelper.floor_double(player.posY) != oldY || MathHelper.floor_double(player.posZ) != oldZ)
session.adjustMana(-cost(), false);
}
}
}
}