net.minecraft.util.Vec3源码实例Demo

类net.minecraft.util.Vec3源码实例Demo

下面列出了net.minecraft.util.Vec3 类实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: SkyblockAddons   文件: NPCUtils.java
/**
 * Checks if a given entity is near any NPC with the given {@link Tag}.
 *
 * @param entity the entity to check
 * @return {@code true} if the entity is near an NPC, {@code false} otherwise
 */
public static boolean isNearAnyNPCWithTag(Entity entity, Tag tag) {
    SkyblockAddons main = SkyblockAddons.getInstance();
    Location currentLocation = main.getUtils().getLocation();

    for (NPC npc:
            NPC_LIST) {
        if (npc.hasLocation(currentLocation)) {
            Vec3 NPCVector = new Vec3(npc.getX(), npc.getY(), npc.getZ());
            Vec3 entityVector = entity.getPositionVector();

            if (NPCVector.distanceTo(entityVector) <= HIDE_RADIUS) {
                if (npc.hasTag(tag))
                    return true;
            }
        }
    }
    return false;
}
 
源代码2 项目: SkyblockAddons   文件: NPCUtils.java
/**
 * Checks if a given entity is near the NPC with the given name.
 *
 * @param entity the entity to check
 * @param NPCName the NPC's name in {@link NPC}
 * @return {@code true} if the entity is near the matching NPC,{@code false} if the entity is not near the matching NPC or no matching NPC is found
 */
public static boolean isNearNPC(Entity entity, String NPCName) {
    SkyblockAddons main = SkyblockAddons.getInstance();
    Location currentLocation = main.getUtils().getLocation();

    for (NPC npc:
         NPC_LIST) {
        if (npc.name().equals(NPCName) && npc.hasLocation(currentLocation)) {
            Vec3 NPCVector = new Vec3(npc.getX(), npc.getY(), npc.getZ());
            Vec3 entityVector = entity.getPositionVector();

            if (NPCVector.distanceTo(entityVector) <= HIDE_RADIUS) {
                return true;
            }
        }
    }
    return false;
}
 
源代码3 项目: SkyblockAddons   文件: NPCUtils.java
/**
 * Checks if a given entity is near any NPC with the given {@link Tag}s.
 *
 * @param entity the entity to check
 * @return {@code true} if the entity is near an NPC with the given tags, {@code false} otherwise
 */
public static boolean isNearAnyNPCWithTags(Entity entity, Set<Tag> tags) {
    SkyblockAddons main = SkyblockAddons.getInstance();
    Location currentLocation = main.getUtils().getLocation();

    for (NPC npc:
            NPC_LIST) {
        if (npc.hasLocation(currentLocation)) {
            Vec3 NPCVector = new Vec3(npc.getX(), npc.getY(), npc.getZ());
            Vec3 entityVector = entity.getPositionVector();

            if (NPCVector.distanceTo(entityVector) <= HIDE_RADIUS) {
                if (npc.getTags().containsAll(tags))
                    return true;
            }
        }
    }
    return false;
}
 
源代码4 项目: Framez   文件: PartFrame.java
@Override
public ExtendedMOP collisionRayTrace(Vec3 start, Vec3 end) {

    ExtendedMOP mop = super.collisionRayTrace(start, end);

    double d = 0.001;

    if (mop != null) {
        if (mop.hitVec.xCoord % 1 == 0)
            mop.hitVec.xCoord += ForgeDirection.getOrientation(mop.sideHit).offsetX * d;
        if (mop.hitVec.yCoord % 1 == 0)
            mop.hitVec.yCoord += ForgeDirection.getOrientation(mop.sideHit).offsetY * d;
        if (mop.hitVec.zCoord % 1 == 0)
            mop.hitVec.zCoord += ForgeDirection.getOrientation(mop.sideHit).offsetZ * d;

        // mop.blockX = (int) Math.floor(mop.hitVec.xCoord);
        // mop.blockY = (int) Math.floor(mop.hitVec.yCoord);
        // mop.blockZ = (int) Math.floor(mop.hitVec.zCoord);
    }

    return mop;
}
 
源代码5 项目: Chisel   文件: General.java
public static MovingObjectPosition getMovingObjectPositionFromPlayer(World par1World, EntityPlayer par2EntityPlayer, boolean par3)
{
    float var4 = 1.0F;
    float var5 = par2EntityPlayer.prevRotationPitch + (par2EntityPlayer.rotationPitch - par2EntityPlayer.prevRotationPitch) * var4;
    float var6 = par2EntityPlayer.prevRotationYaw + (par2EntityPlayer.rotationYaw - par2EntityPlayer.prevRotationYaw) * var4;
    double var7 = par2EntityPlayer.prevPosX + (par2EntityPlayer.posX - par2EntityPlayer.prevPosX) * var4;
    double var9 = par2EntityPlayer.prevPosY + (par2EntityPlayer.posY - par2EntityPlayer.prevPosY) * var4 + 1.62D - par2EntityPlayer.yOffset;
    double var11 = par2EntityPlayer.prevPosZ + (par2EntityPlayer.posZ - par2EntityPlayer.prevPosZ) * var4;
    //TODO- 1.7.10 fix?
    Vec3 var13 = Vec3.createVectorHelper(var7, var9, var11);
    float var14 = MathHelper.cos(-var6 * 0.017453292F - (float) Math.PI);
    float var15 = MathHelper.sin(-var6 * 0.017453292F - (float) Math.PI);
    float var16 = -MathHelper.cos(-var5 * 0.017453292F);
    float var17 = MathHelper.sin(-var5 * 0.017453292F);
    float var18 = var15 * var16;
    float var20 = var14 * var16;
    double var21 = 5.0D;

    if(par2EntityPlayer instanceof EntityPlayerMP)
    {
        var21 = ((EntityPlayerMP) par2EntityPlayer).theItemInWorldManager.getBlockReachDistance();
    }

    Vec3 var23 = var13.addVector(var18 * var21, var17 * var21, var20 * var21);
    return par1World.rayTraceBlocks(var13, var23, par3);
}
 
源代码6 项目: Hyperium   文件: VortexOfDoomAnimation.java
@Override
public List<Vec3> render(EntityPlayer player, double x, double y, double z) {
    ArrayList<Vec3> vec3s = new ArrayList<>();
    Vec3 base = new Vec3(x, y + 1.7, z);
    double l = Math.abs(.5 - ((System.currentTimeMillis() % 10000D) / 10000D)) * 4;
    l = l <= 1 ? Math.pow(l, 2) / 2 : -(Math.pow(l - 2, 2) - 2) / 2;
    l *= 2;

    for (int i = 0; i < 40; i++) {
        double v = Math.PI / 40 * i * 2;

        for (int j = 0; j < 6; j++) {
            vec3s.add(base.addVector(MathHelper.sin((float) (v + l * j / 2.5D)), -.2 * j, MathHelper.cos((float) (v + l * j / 2.5D))));
        }
    }

    return vec3s;
}
 
源代码7 项目: WirelessRedstone   文件: WirelessBolt.java
private void vecBBDamageSegment(Vector3 start, Vector3 end, ArrayList<Entity> entitylist) {
    Vec3 start3D = start.toVec3D();
    Vec3 end3D = end.toVec3D();

    for (Iterator<Entity> iterator = entitylist.iterator(); iterator.hasNext(); ) {
        Entity entity = iterator.next();
        if (entity instanceof EntityLivingBase &&
                (entity.boundingBox.isVecInside(start3D) || entity.boundingBox.isVecInside(end3D))) {
            if (entity instanceof EntityPlayer)
                entity.attackEntityFrom(WirelessRedstoneCore.damagebolt, playerdamage);
            else
                entity.attackEntityFrom(WirelessRedstoneCore.damagebolt, entitydamage);

            ether.jamEntity((EntityLivingBase) entity, true);
        }
    }
}
 
源代码8 项目: GardenCollection   文件: LanternRenderer.java
private void renderChain (IBlockAccess world, RenderBlocks renderer, BlockLantern block, int x, int y, int z) {
    Block lowerBlock = world.getBlock(x, y - 1, z);
    if (lowerBlock.isSideSolid(world, x, y - 1, z, ForgeDirection.UP))
        return;

    Block upperBlock = world.getBlock(x, y + 1, z);
    if (upperBlock instanceof IChainSingleAttachable) {
        Vec3 attach = ((IChainSingleAttachable) upperBlock).getChainAttachPoint(world, x, y + 1, z, 0);
        if (attach != null && attach != defaultAttachPoint) {
            RenderHelper.instance.setRenderBounds(0, 0, 0, 1, attach.yCoord, 1);
            RenderHelper.instance.renderCrossedSquares(world, ModBlocks.heavyChain, x, y + 1, z, ModBlocks.lightChain.getIcon(0, 4));
            return;
        }
    }

    IAttachable attachable = GardenAPI.instance().registries().attachable().getAttachable(upperBlock, world.getBlockMetadata(x, y + 1, z));
    if (attachable != null && attachable.isAttachable(world, x, y + 1, z, 0)) {
        double depth = attachable.getAttachDepth(world, x, y + 1, z, 0);
        if (depth > 0) {
            RenderHelper.instance.setRenderBounds(0, 0, 0, 1, depth, 1);
            RenderHelper.instance.renderCrossedSquares(world, ModBlocks.heavyChain, x, y + 1, z, ModBlocks.lightChain.getIcon(0, 4));
        }
    }
}
 
源代码9 项目: OpenPeripheral-Addons   文件: AdapterSensor.java
@ScriptCallable(returnTypes = ReturnType.TABLE, description = "Get a table of information about a single block in the surrounding area. Includes map color and whether each block is UNKNOWN, AIR, LIQUID, or SOLID.")
public Map<String, Object> sonicScanTarget(ISensorEnvironment env,
		@Arg(name = "xOffset", description = "The target's offset from the sensor on the X-Axis.") int dx,
		@Arg(name = "yOffset", description = "The target's offset from the sensor on the Y-Axis.") int dy,
		@Arg(name = "zOffset", description = "The target's offset from the sensor on the Z-Axis.") int dz) {
	int range = 1 + env.getSensorRange() / 2;
	int rangeSq = range * range;
	if (checkRange(dx, dy, dz, rangeSq)) return null;

	Vec3 sensorPos = env.getLocation();
	int sx = MathHelper.floor_double(sensorPos.xCoord);
	int sy = MathHelper.floor_double(sensorPos.yCoord);
	int sz = MathHelper.floor_double(sensorPos.zCoord);

	return describeBlock(env.getWorld(), sx, sy, sz, dx, dy, dz);
}
 
源代码10 项目: Chisel-2   文件: General.java
public static MovingObjectPosition getMovingObjectPositionFromPlayer(World par1World, EntityPlayer par2EntityPlayer, boolean par3) {
	float var4 = 1.0F;
	float var5 = par2EntityPlayer.prevRotationPitch + (par2EntityPlayer.rotationPitch - par2EntityPlayer.prevRotationPitch) * var4;
	float var6 = par2EntityPlayer.prevRotationYaw + (par2EntityPlayer.rotationYaw - par2EntityPlayer.prevRotationYaw) * var4;
	double var7 = par2EntityPlayer.prevPosX + (par2EntityPlayer.posX - par2EntityPlayer.prevPosX) * var4;
	double var9 = par2EntityPlayer.prevPosY + (par2EntityPlayer.posY - par2EntityPlayer.prevPosY) * var4 + 1.62D - par2EntityPlayer.yOffset;
	double var11 = par2EntityPlayer.prevPosZ + (par2EntityPlayer.posZ - par2EntityPlayer.prevPosZ) * var4;
	// TODO- 1.7.10 fix?
	Vec3 var13 = Vec3.createVectorHelper(var7, var9, var11);
	float var14 = MathHelper.cos(-var6 * 0.017453292F - (float) Math.PI);
	float var15 = MathHelper.sin(-var6 * 0.017453292F - (float) Math.PI);
	float var16 = -MathHelper.cos(-var5 * 0.017453292F);
	float var17 = MathHelper.sin(-var5 * 0.017453292F);
	float var18 = var15 * var16;
	float var20 = var14 * var16;
	double var21 = 5.0D;

	if (par2EntityPlayer instanceof EntityPlayerMP) {
		var21 = ((EntityPlayerMP) par2EntityPlayer).theItemInWorldManager.getBlockReachDistance();
	}

	Vec3 var23 = var13.addVector(var18 * var21, var17 * var21, var20 * var21);
	return par1World.rayTraceBlocks(var13, var23, par3);
}
 
源代码11 项目: Gadomancy   文件: TileNodeManipulator.java
private void manipulationTick() {
    workTick++;
    if(workTick < 300) {
        if(workTick % 16 == 0) {
            PacketStartAnimation packet = new PacketStartAnimation(PacketStartAnimation.ID_RUNES, xCoord, yCoord, zCoord);
            PacketHandler.INSTANCE.sendToAllAround(packet, getTargetPoint(32));
        }
        if(worldObj.rand.nextInt(4) == 0) {
            Vec3 rel = getRelPillarLoc(worldObj.rand.nextInt(4));
            PacketTCNodeBolt bolt = new PacketTCNodeBolt(xCoord + 0.5F, yCoord + 2.5F, zCoord + 0.5F, (float) (xCoord + 0.5F + rel.xCoord), (float) (yCoord + 2.5F + rel.yCoord), (float) (zCoord + 0.5F + rel.zCoord), 0, false);
            PacketHandler.INSTANCE.sendToAllAround(bolt, getTargetPoint(32));
        }
    } else {
        scheduleManipulation();
    }
}
 
源代码12 项目: OpenPeripheral   文件: EntityMetadataBuilder.java
private static Map<String, Object> createBasicProperties(Entity entity, Vec3 relativePos) {
	Map<String, Object> map = Maps.newHashMap();
	addPositionInfo(map, entity, relativePos);
	map.put("name", entity.getCommandSenderName());
	map.put("id", entity.getEntityId());
	map.put("uuid", entity.getUniqueID());

	if (entity.riddenByEntity != null) {
		map.put("riddenBy", entity.riddenByEntity.getEntityId());
	}

	if (entity.ridingEntity != null) {
		map.put("ridingEntity", entity.ridingEntity.getEntityId());
	}
	return map;
}
 
源代码13 项目: Gadomancy   文件: TileEssentiaCompressor.java
private void playVortexEffects() {
    for (int a = 0; a < Thaumcraft.proxy.particleCount(1); a++) {
        int tx = this.xCoord + this.worldObj.rand.nextInt(4) - this.worldObj.rand.nextInt(4);
        int ty = this.yCoord + 1 + this.worldObj.rand.nextInt(4) - this.worldObj.rand.nextInt(4);
        int tz = this.zCoord + this.worldObj.rand.nextInt(4) - this.worldObj.rand.nextInt(4);
        if (ty > this.worldObj.getHeightValue(tx, tz)) {
            ty = this.worldObj.getHeightValue(tx, tz);
        }
        Vec3 v1 = Vec3.createVectorHelper(this.xCoord + 0.5D, this.yCoord + 1.5D, this.zCoord + 0.5D);
        Vec3 v2 = Vec3.createVectorHelper(tx + 0.5D, ty + 0.5D, tz + 0.5D);

        MovingObjectPosition mop = ThaumcraftApiHelper.rayTraceIgnoringSource(this.worldObj, v1, v2, true, false, false);
        if ((mop != null) && (getDistanceFrom(mop.blockX, mop.blockY, mop.blockZ) < 16.0D)) {
            tx = mop.blockX;
            ty = mop.blockY;
            tz = mop.blockZ;
            Block bi = this.worldObj.getBlock(tx, ty, tz);
            int md = this.worldObj.getBlockMetadata(tx, ty, tz);
            if (!bi.isAir(this.worldObj, tx, ty, tz)) {
                Thaumcraft.proxy.hungryNodeFX(this.worldObj, tx, ty, tz, this.xCoord, this.yCoord + 1, this.zCoord, bi, md);
            }
        }
    }
}
 
源代码14 项目: qcraft-mod   文件: TileEntityQBlock.java
private boolean checkRayClear( Vec3 playerPos, Vec3 blockPos )
{
    MovingObjectPosition position = worldObj.rayTraceBlocks( playerPos, blockPos );
    if( position == null )
    {
        return true;
    }
    else if( position.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK )
    {
        if( position.blockX == xCoord &&
                position.blockY == yCoord &&
                position.blockZ == zCoord )
        {
            return true;
        }
    }
    return false;
}
 
源代码15 项目: Et-Futurum   文件: ServerEventHandler.java
@SubscribeEvent
public void entityHurtEvent(LivingHurtEvent event) {
	if (!EtFuturum.enableDmgIndicator)
		return;
	int amount = MathHelper.floor_float(Math.min(event.entityLiving.getHealth(), event.ammount) / 2F);
	if (amount <= 0)
		return;

	// If the attacker is a player spawn the hearts aligned and facing it
	if (event.source instanceof EntityDamageSource) {
		EntityDamageSource src = (EntityDamageSource) event.source;
		Entity attacker = src.getSourceOfDamage();
		if (attacker instanceof EntityPlayer && !(attacker instanceof FakePlayer)) {
			EntityPlayer player = (EntityPlayer) attacker;
			Vec3 look = player.getLookVec();
			look.rotateAroundY((float) Math.PI / 2);
			for (int i = 0; i < amount; i++) {
				double x = event.entityLiving.posX - amount * 0.35 * look.xCoord / 2 + i * 0.35 * look.xCoord;
				double y = event.entityLiving.posY + 1.5 + event.entityLiving.worldObj.rand.nextGaussian() * 0.05;
				double z = event.entityLiving.posZ - amount * 0.35 * look.zCoord / 2 + i * 0.35 * look.zCoord;
				EtFuturum.networkWrapper.sendToAllAround(new BlackHeartParticlesMessage(x, y, z), new TargetPoint(player.worldObj.provider.dimensionId, x, y, z, 64));
			}
		}
	}
}
 
源代码16 项目: OpenPeripheral-Addons   文件: AdapterSensor.java
@ScriptCallable(returnTypes = ReturnType.TABLE, description = "Get a table of information about the surrounding area. Includes map color and whether each block is UNKNOWN, AIR, LIQUID, or SOLID.")
public List<Map<String, Object>> sonicScan(ISensorEnvironment env) {
	int range = 1 + env.getSensorRange() / 2;
	List<Map<String, Object>> results = Lists.newArrayList();
	Vec3 sensorPos = env.getLocation();
	int sx = MathHelper.floor_double(sensorPos.xCoord);
	int sy = MathHelper.floor_double(sensorPos.yCoord);
	int sz = MathHelper.floor_double(sensorPos.zCoord);

	final World world = env.getWorld();

	final int rangeSq = range * range;

	for (int dx = -range; dx <= range; dx++) {
		for (int dy = -range; dy <= range; dy++) {
			for (int dz = -range; dz <= range; dz++) {
				if (checkRange(dx, dy, dz, rangeSq)) {
					Map<String, Object> result = describeBlock(world, sx, sy, sz, dx, dy, dz);
					if (result != null) results.add(result);
				}
			}
		}
	}

	return results;
}
 
源代码17 项目: PneumaticCraft   文件: DroneEntityAIPickupItems.java
/**
 * Returns whether an in-progress EntityAIBase should continue executing
 */
@Override
public boolean continueExecuting(){
    if(curPickingUpEntity.isDead) return false;
    if(Vec3.createVectorHelper(curPickingUpEntity.posX, curPickingUpEntity.posY, curPickingUpEntity.posZ).distanceTo(drone.getPosition()) < 1.5) {
        ItemStack stack = curPickingUpEntity.getEntityItem();
        if(itemPickupWidget.isItemValidForFilters(stack)) {
            new EventHandlerPneumaticCraft().onPlayerPickup(new EntityItemPickupEvent(drone.getFakePlayer(), curPickingUpEntity));//not posting the event globally, as I don't have a way of handling a canceled event.
            int stackSize = stack.stackSize;
            ItemStack remainder = PneumaticCraftUtils.exportStackToInventory(drone.getInventory(), stack, ForgeDirection.UP);//side doesn't matter, drones aren't ISided.
            if(remainder == null) {
                drone.onItemPickupEvent(curPickingUpEntity, stackSize);
                curPickingUpEntity.setDead();
            }
        }
        return false;
    }
    return !drone.getPathNavigator().hasNoPath();
}
 
源代码18 项目: Artifacts   文件: PlaceTraps.java
private boolean coveredSpikedPit(Random rand, World world, Vec3 c, Block blockID, int meta) {
	if(meta < 0) {
		meta = rand.nextInt(-1 * meta);
	}
	for(int i=-2; i<=2; i++) {
		for(int j=-2; j<=2; j++) {
			if(i > -2 && i < 2 && j > -2 && j < 2) {
				world.setBlock(MathHelper.floor_double(c.xCoord+i), MathHelper.floor_double(c.yCoord), MathHelper.floor_double(c.zCoord+j), BlockIllusionary.instance, 0, 3);
				world.setBlock(MathHelper.floor_double(c.xCoord+i), MathHelper.floor_double(c.yCoord-1), MathHelper.floor_double(c.zCoord+j), Blocks.air, 0, 3);
				world.setBlock(MathHelper.floor_double(c.xCoord+i), MathHelper.floor_double(c.yCoord-2), MathHelper.floor_double(c.zCoord+j), Blocks.air, 0, 3);
				world.setBlock(MathHelper.floor_double(c.xCoord+i), MathHelper.floor_double(c.yCoord-3), MathHelper.floor_double(c.zCoord+j), BlockSpikes.instance, 0, 3);
				world.setBlock(MathHelper.floor_double(c.xCoord+i), MathHelper.floor_double(c.yCoord-4), MathHelper.floor_double(c.zCoord+j), blockID, meta, 3);
			}
			else {
				if(world.getBlock(MathHelper.floor_double(c.xCoord+i), MathHelper.floor_double(c.yCoord-1), MathHelper.floor_double(c.zCoord+j)).isOpaqueCube())
					world.setBlock(MathHelper.floor_double(c.xCoord+i), MathHelper.floor_double(c.yCoord-1), MathHelper.floor_double(c.zCoord+j), blockID, meta, 3);
				if(world.getBlock(MathHelper.floor_double(c.xCoord+i), MathHelper.floor_double(c.yCoord-2), MathHelper.floor_double(c.zCoord+j)).isOpaqueCube())
					world.setBlock(MathHelper.floor_double(c.xCoord+i), MathHelper.floor_double(c.yCoord-2), MathHelper.floor_double(c.zCoord+j), blockID, meta, 3);
				if(world.getBlock(MathHelper.floor_double(c.xCoord+i), MathHelper.floor_double(c.yCoord-3), MathHelper.floor_double(c.zCoord+j)).isOpaqueCube())
					world.setBlock(MathHelper.floor_double(c.xCoord+i), MathHelper.floor_double(c.yCoord-3), MathHelper.floor_double(c.zCoord+j), blockID, meta, 3);
			}
		}
	}
	return true;
}
 
@Override
public Object getMeta(EntityZombie target, Vec3 relativePos) {
	Map<String, Object> map = Maps.newHashMap();

	map.put("isVillagerZombie", target.isVillager());
	map.put("convertingToVillager", target.isConverting());

	return map;
}
 
源代码20 项目: Artifacts   文件: PlaceTraps.java
private void pyramidArrowTrap(Random rand, World world, int x, int y, int z) {
	for(int ox = -1; ox <= 1; ox++) {
		for(int oz = -1; oz <= 1; oz++) {
			world.setBlock(x+ox, 51, z+oz, Blocks.sandstone);
		}
	}
	for(int ox = -1; ox <= 1; ox++) {
		for(int oz = -1; oz <= 1; oz++) {
			Vec3 v = Vec3.createVectorHelper(x+ox, 52, z+oz);
			simpleTrap(rand, world, v);
		}
	}
}
 
源代码21 项目: LiquidBounce   文件: TeleportHit.java
@EventTarget
public void onMotion(MotionEvent event) {
    if(event.getEventState() != EventState.PRE)
        return;

    final Entity facedEntity = RaycastUtils.raycastEntity(100D, raycastedEntity -> raycastedEntity instanceof EntityLivingBase);
    if(mc.gameSettings.keyBindAttack.isKeyDown() && EntityUtils.isSelected(facedEntity, true) && facedEntity.getDistanceSqToEntity(mc.thePlayer) >= 1D)
        targetEntity = (EntityLivingBase) facedEntity;

    if(targetEntity != null) {
        if(!shouldHit) {
            shouldHit = true;
            return;
        }

        if(mc.thePlayer.fallDistance > 0F) {
            final Vec3 rotationVector = RotationUtils.getVectorForRotation(new Rotation(mc.thePlayer.rotationYaw, 0F));
            final double x = mc.thePlayer.posX + rotationVector.xCoord * (mc.thePlayer.getDistanceToEntity(targetEntity) - 1.0F);
            final double z = mc.thePlayer.posZ + rotationVector.zCoord * (mc.thePlayer.getDistanceToEntity(targetEntity) - 1.0F);
            final double y = targetEntity.getPosition().getY() + 0.25D;

            PathUtils.findPath(x, y + 1.0D, z, 4D).forEach(pos -> mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(pos.getX(), pos.getY(), pos.getZ(), false)));

            mc.thePlayer.swingItem();
            mc.thePlayer.sendQueue.addToSendQueue(new C02PacketUseEntity(targetEntity, C02PacketUseEntity.Action.ATTACK));
            mc.thePlayer.onCriticalHit(targetEntity);
            shouldHit = false;
            targetEntity = null;
        }else if(mc.thePlayer.onGround)
            mc.thePlayer.jump();
    }else
        shouldHit = false;
}
 
源代码22 项目: OpenPeripheral   文件: EntityMetadataBuilder.java
@Override
public Map<String, Object> getEntityMetadata(Entity entity, Vec3 relativePos) {
	Map<String, Object> map = createBasicProperties(entity, relativePos);

	final Iterable<IEntityMetaProvider<?>> providers = getProviders(entity).values();
	fillCustomProperties(map, providers, entity, relativePos);
	return map;
}
 
@Override
public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 origin, Vec3 direction){
    TileEntity te = world.getTileEntity(x, y, z);
    if(te instanceof TileEntityOmnidirectionalHopper) {
        ForgeDirection o = ((TileEntityOmnidirectionalHopper)te).getDirection();
        boolean isColliding = false;
        setBlockBounds(o.offsetX == 1 ? 10 / 16F : 0, o.offsetY == 1 ? 10 / 16F : 0, o.offsetZ == 1 ? 10 / 16F : 0, o.offsetX == -1 ? 6 / 16F : 1, o.offsetY == -1 ? 6 / 16F : 1, o.offsetZ == -1 ? 6 / 16F : 1);
        if(super.collisionRayTrace(world, x, y, z, origin, direction) != null) isColliding = true;
        setBlockBounds(4 / 16F, 4 / 16F, 4 / 16F, 12 / 16F, 12 / 16F, 12 / 16F);
        if(super.collisionRayTrace(world, x, y, z, origin, direction) != null) isColliding = true;
        setBlockBounds(0, 0, 0, 1, 1, 1);
        return isColliding ? super.collisionRayTrace(world, x, y, z, origin, direction) : null;
    }
    return null;
}
 
源代码24 项目: Hyperium   文件: PlayerSwingEvent.java
public PlayerSwingEvent(@NotNull UUID player, @NotNull Vec3 posVec, @NotNull Vec3 lookVec, @NotNull BlockPos pos) {
    Preconditions.checkNotNull(player, "player");
    Preconditions.checkNotNull(posVec, "posVec");
    Preconditions.checkNotNull(lookVec, "lookVec");
    Preconditions.checkNotNull(pos, "pos");

    this.player = player;
    this.posVec = posVec;
    this.lookVec = lookVec;
    this.pos = pos;
}
 
源代码25 项目: Artifacts   文件: ComponentFireball.java
@Override
public boolean hitEntity(ItemStack itemStack, EntityLivingBase entityLivingHit, EntityLivingBase entityLivingPlayer) {
	
	if(!entityLivingPlayer.worldObj.isRemote && entityLivingPlayer instanceof EntityPlayer) {
		System.out.println("Entity was hit. Summoning fireball.");
		EntityPlayer player = (EntityPlayer) entityLivingPlayer;
		World world = player.worldObj;
		
		Vec3 vec3 = player.getLook(1.0F);
		double d8 = 4.0D;
		//System.out.println(vec3);
		//EntityLargeFireball entitylargefireball = new EntityLargeFireball(world, p.posX + vec3.xCoord * d8, p.posY, p.posZ + vec3.zCoord * d8, vec3.xCoord, vec3.yCoord, vec3.zCoord);
		EntityLargeFireball entitylargefireball = new EntityLargeFireball(world, player, vec3.xCoord, vec3.yCoord, vec3.zCoord);
		entitylargefireball.posX += vec3.xCoord * d8;
		entitylargefireball.posZ += vec3.zCoord * d8;
		entitylargefireball.accelerationX = vec3.xCoord;
		entitylargefireball.accelerationY = vec3.yCoord;
		entitylargefireball.accelerationZ = vec3.zCoord;
		entitylargefireball.field_92057_e = 1;
		/*entitylargefireball.posX = p.posX;// + vec3.xCoord * d8;
               entitylargefireball.posY = p.posY + (double)(p.height / 2.0F);
               entitylargefireball.posZ = p.posZ;// + vec3.zCoord * d8;*/
		//System.out.println(entitylargefireball.posX + "," + entitylargefireball.posY + "," + entitylargefireball.posZ);
		world.spawnEntityInWorld(entitylargefireball);
		itemStack.damageItem(1, player);
		
	}
	return false;
}
 
源代码26 项目: GardenCollection   文件: BlockThinLog.java
@Override
public Vec3 getChainAttachPoint (IBlockAccess blockAccess, int x, int y, int z, int side) {
    int connectFlags = calcConnectionFlags(blockAccess, x, y, z);

    switch (side) {
        case 0: return (connectFlags & 1) == 0 ? attachPoints[0] : null;
        case 1: return (connectFlags & 2) == 0 ? attachPoints[1] : null;
        case 2: return (connectFlags & 4) == 0 ? attachPoints[2] : null;
        case 3: return (connectFlags & 8) == 0 ? attachPoints[3] : null;
        case 4: return (connectFlags & 16) == 0 ? attachPoints[4] : null;
        case 5: return (connectFlags & 32) == 0 ? attachPoints[5] : null;
    }

    return null;
}
 
源代码27 项目: Hyperium   文件: StaticTrailAnimation.java
@Override
public List<Vec3> render(EntityPlayer player, double x, double y, double z) {
    ArrayList<Vec3> vec3s;
    float rotationYaw = player.rotationYawHead;
    rotationYaw -= 90;
    Vec3 base = new Vec3(x + MathHelper.cos((float) Math.toRadians(rotationYaw)), y + 1.8D, z + MathHelper.sin((float) Math.toRadians(rotationYaw)));
    ArrayList<Vec3> result = new ArrayList<>();
    for (int i = 0; i < 4; i++) {
        Vec3 vec3 = base.addVector(0, -.4 * i, 0);
        result.add(vec3);
    }
    vec3s = result;
    return vec3s;
}
 
源代码28 项目: GardenCollection   文件: BlockHoop.java
@Override
public Vec3[] getChainAttachPoints (int side) {
    if (side == 1)
        return attachPoints;

    return null;
}
 
源代码29 项目: Hyperium   文件: TripleTwirlAnimation.java
@Override
public List<Vec3> render(EntityPlayer player, double x, double y, double z) {
    double l = (System.currentTimeMillis() % 1000) / 1000D;
    l *= Math.PI * 2 / 3;
    List<Vec3> list = new ArrayList<>();
    y += 1.8;
    Vec3 vec3 = new Vec3(x, y, z);
    list.add(vec3.addVector(MathHelper.cos((float) l), 0, MathHelper.sin(((float) l))));
    l += Math.PI * 2 / 3;
    list.add(vec3.addVector(MathHelper.cos((float) l), 0, MathHelper.sin(((float) l))));
    l += Math.PI * 2 / 3;
    list.add(vec3.addVector(MathHelper.cos((float) l), 0, MathHelper.sin(((float) l))));
    return list;
}
 
@Override
public Object getMeta(EntityItemFrame target, Vec3 relativePos) {
	Map<String, Object> result = Maps.newHashMap();

	result.put("item", target.getDisplayedItem());
	result.put("rotation", target.getRotation());

	return result;
}
 
如果文章对您有帮助,请点击页面广告。以鼓励作者做出的努力。
 类所在包
 类方法
 同包方法