• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Vec2f类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.minecraft.util.math.Vec2f的典型用法代码示例。如果您正苦于以下问题:Java Vec2f类的具体用法?Java Vec2f怎么用?Java Vec2f使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Vec2f类属于net.minecraft.util.math包,在下文中一共展示了Vec2f类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: renderIngredients

import net.minecraft.util.math.Vec2f; //导入依赖的package包/类
private void renderIngredients(TileEntityInfusionRepair te, double x, double y, double z, float partialTicks)
   {
GlStateManager.pushMatrix();
IItemHandler itemHandler = CapUtils.getItemHandler(te);
for(int slot = 0; slot < 8; slot++)
{
    ItemStack stack = itemHandler.getStackInSlot(TileEntityInfusionRepair.SLOT_ENCH_ITEM + 1 + slot);
    Vec2f ingredientPos = ingredientPositions[slot];
    if(Prep1_11.isEmpty(stack)) continue;
    
    GlStateManager.pushMatrix();
    GlStateManager.translate(ingredientPos.x * PIXEL_SIZE, -0.15F, ingredientPos.y * PIXEL_SIZE);
    GlStateManager.scale(0.5F, 0.5F, 0.5F);
    GlStateManager.rotate(((mc.player.ticksExisted + partialTicks) * 60.0f) / 10.0F, 0.0F, 1.0F, 0.0F);
    mc.getRenderItem().renderItem(stack, TransformType.GROUND);
    GlStateManager.scale(1.0F, 1.0F, 1.0F);
    GlStateManager.popMatrix();
}
GlStateManager.popMatrix();
   }
 
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:21,代码来源:InfusionRender.java


示例2: onBlockPlacedBy

import net.minecraft.util.math.Vec2f; //导入依赖的package包/类
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
	EnumFacing facing = EnumFacing.UP;
	Vec2f rot = placer.getPitchYaw();
	//System.out.println("Placer x: "+rot.x+" y:"+rot.y+" yaw:"+placer.getRotationYawHead());
	
	if (rot.x > 45) {
		facing = EnumFacing.DOWN;
	} else if (rot.x > -45) {
		facing = placer.getAdjustedHorizontalFacing();
	}
	
	world.setBlockState(pos,
			this.getStateFromMeta(stack.getMetadata())
				.withProperty(FACING, facing));
}
 
开发者ID:elytra,项目名称:Engination,代码行数:17,代码来源:BlockGravityField.java


示例3: getTypeHoveredOver

import net.minecraft.util.math.Vec2f; //导入依赖的package包/类
public TotemType getTypeHoveredOver(float centerX, float centerY, int mouseX, int mouseY) {
    TotemType typeHoveredOver = TotemType.NONE;
    for (TotemType type : TotemType.values()) {
        float baseAngle = (360 / TotemType.values().length);
        double angle = (baseAngle * type.getMeta()) - ANGLE_OFFSET;

        double mouseAngle = getMouseAngle(new Vec2f(centerX, centerY), new Vec2f(mouseX, mouseY));
        double minToCheck = sanitizeDegree(angle - (baseAngle / 2));
        double maxToCheck = sanitizeDegree(angle + (baseAngle / 2));
        if (minToCheck > maxToCheck) {
            minToCheck -= 360;
        }
        if (mouseAngle > minToCheck
                && mouseAngle < maxToCheck) {
            typeHoveredOver = type;
        }
    }
    return typeHoveredOver;
}
 
开发者ID:CorwinJV,项目名称:MobTotems,代码行数:20,代码来源:CarvingSelectorGui.java


示例4: pickPolar

import net.minecraft.util.math.Vec2f; //导入依赖的package包/类
private static Vec2f pickPolar(float rmin, float rmax) {
	float yaw = rnd.nextFloat()*TAU;
	float dist = rnd.nextFloat()*(rmax-rmin) + rmin; 
	float x = MathHelper.cos(yaw)*dist;
	float z = MathHelper.sin(yaw)*dist;
	return new Vec2f(x,z);
}
 
开发者ID:elytra,项目名称:Thermionics,代码行数:8,代码来源:FX.java


示例5: pickRing

import net.minecraft.util.math.Vec2f; //导入依赖的package包/类
private static void pickRing(float r, float angularDensity) {
	for(float theta = 0; theta<TAU; theta+=angularDensity) {
		float x = MathHelper.cos(theta)*r;
		float z = MathHelper.sin(theta)*r;
		locationBuffer.add(new Vec2f(x,z));
	}
}
 
开发者ID:elytra,项目名称:Thermionics,代码行数:8,代码来源:FX.java


示例6: update

import net.minecraft.util.math.Vec2f; //导入依赖的package包/类
@Override
public void update(World world) {
	if (ticks%3==0) {
		locationBuffer.clear();
		pickRing(0.5f, SEGMENTS);
		for(Vec2f vec : locationBuffer) {
			Particle particle = new ParticleVelocity(world,
					x+vec.x, y+0.5f, z+vec.y,
					0f, -0.3f, 0f
					);
			particle.setParticleTextureIndex(5); //Midway through redstone
			particle.setRBGColorF(0.7f, 0.2f, 0.7f);
			
			
			Minecraft.getMinecraft().effectRenderer.addEffect(particle);
		}
	}
	float sx = (rnd.nextFloat()*2) - 1;
	float sz = (rnd.nextFloat()*2) - 1;
	if (rnd.nextBoolean()) {
		Particle star = new ParticleVelocity(world,
				x+sx, y-0.5f, z+sz,
				0f, 0.35f, 0f
				);
		star.setParticleTextureIndex(65); //Crit stars
		Minecraft.getMinecraft().effectRenderer.addEffect(star);
	}
	//star.setRBGColorF(0.7f, 0.2f, 0.7f);
	
	if (ticks>9) die();
}
 
开发者ID:elytra,项目名称:Thermionics,代码行数:32,代码来源:FX.java


示例7: getPitchYaw

import net.minecraft.util.math.Vec2f; //导入依赖的package包/类
/**
 * returns the Entity's pitch and yaw as a Vec2f
 */
@SideOnly(Side.CLIENT)
public Vec2f getPitchYaw()
{
    Vec2f vec2f = new Vec2f(this.rotationPitch, this.rotationYaw);
    return vec2f;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:10,代码来源:Entity.java


示例8: getCurrentRenderOffset

import net.minecraft.util.math.Vec2f; //导入依赖的package包/类
public Vec2f getCurrentRenderOffset(float x, float z) {
    Minecraft mc = Minecraft.getMinecraft();
    double sc = new ScaledResolution(mc).getScaleFactor();
    double oX = x + 16D / sc;
    double oZ = z + 16D / sc;
    Vec3d tr = getCurrentMachineTranslate();
    return new Vec2f((float) (oX + tr.x), (float) (oZ + tr.z));
}
 
开发者ID:HellFirePvP,项目名称:ModularMachinery,代码行数:9,代码来源:DynamicMachineRenderContext.java


示例9: rotate

import net.minecraft.util.math.Vec2f; //导入依赖的package包/类
public static Vec2f rotate(@Nonnull final Vec2f coord, final float radians) {
       final float f = cos(radians);
       final float f1 = sin(radians);
       final float d0 = coord.x * f + coord.y * f1;
       final float d1 = coord.y * f - coord.x * f1;
       return new Vec2f(d0, d1);
}
 
开发者ID:OreCruncher,项目名称:DynamicSurroundings,代码行数:8,代码来源:MathStuff.java


示例10: intersect

import net.minecraft.util.math.Vec2f; //导入依赖的package包/类
public Vec2f intersect(Vec3d r1, Vec3d r2) {
//        System.out.println("Plane[" + v(s1) + " | " + v(s2) + " | " + v(s3) + " | " + v(s4) + "]");
//        System.out.println("    Ray[" + v(r1) + " | " + v(r2) + "]");

        Vec3d dS21 = s2.subtract(s1);
        Vec3d dS31 = s3.subtract(s1);
        Vec3d n = dS21.crossProduct(dS31);

        // 2.
        Vec3d dR = r1.subtract(r2);

        double ndotdR = n.dotProduct(dR);

        if (Math.abs(ndotdR) < 1e-6f) { // Choose your tolerance
            return null;
        }

        double t = -n.dotProduct(r1.subtract(s1)) / ndotdR;
        Vec3d M = r1.add(dR.scale(t));

        // 3.
        Vec3d dMS1 = M.subtract(s1);
        double u = dMS1.dotProduct(dS21);
        double v = dMS1.dotProduct(dS31);

//        System.out.println("    u = " + u + "," + v);
//        System.out.println("    M = " + v(M));

        // 4.
        if (u >= 0.0 && u <= dS21.dotProduct(dS21) &&
                v >= 0.0 && v <= dS31.dotProduct(dS31)) {
            return new Vec2f((float)u, (float)v);
        } else {
            return null;
        }
    }
 
开发者ID:McJty,项目名称:AquaMunda,代码行数:37,代码来源:Plane.java


示例11: getPitchYaw

import net.minecraft.util.math.Vec2f; //导入依赖的package包/类
@Override
public Vec2f getPitchYaw() {
	return super.getPitchYaw();
}
 
开发者ID:orbwoi,项目名称:UniversalRemote,代码行数:5,代码来源:EntityPlayerMPProxy.java


示例12: getPitchYaw

import net.minecraft.util.math.Vec2f; //导入依赖的package包/类
/**
 * returns the Entity's pitch and yaw as a Vec2f
 */
public Vec2f getPitchYaw()
{
    Vec2f vec2f = new Vec2f(this.rotationPitch, this.rotationYaw);
    return vec2f;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:9,代码来源:Entity.java


示例13: getMoveVector

import net.minecraft.util.math.Vec2f; //导入依赖的package包/类
public Vec2f getMoveVector()
{
    return new Vec2f(this.moveStrafe, this.moveForward);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:MovementInput.java


示例14: set

import net.minecraft.util.math.Vec2f; //导入依赖的package包/类
public void set(final String name, final Vec2f vector) throws ShaderException {
	this.set(name, vector.x, vector.y);
}
 
开发者ID:OreCruncher,项目名称:DynamicSurroundings,代码行数:4,代码来源:ShaderProgram.java


示例15: getMouseAngle

import net.minecraft.util.math.Vec2f; //导入依赖的package包/类
public double getMouseAngle(Vec2f referencePoint, Vec2f mousePos) {
    Vec2f relativePos = new Vec2f(mousePos.x - referencePoint.x, mousePos.y - referencePoint.y);
    double degrees = Math.toDegrees(Math.atan2(relativePos.y, relativePos.x));
    return sanitizeDegree(degrees);
}
 
开发者ID:CorwinJV,项目名称:MobTotems,代码行数:6,代码来源:CarvingSelectorGui.java


示例16: func_189653_aC

import net.minecraft.util.math.Vec2f; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public Vec2f func_189653_aC()
{
    Vec2f vec2f = new Vec2f(this.rotationPitch, this.rotationYaw);
    return vec2f;
}
 
开发者ID:BlazeAxtrius,项目名称:ExpandedRailsMod,代码行数:7,代码来源:Entity.java



注:本文中的net.minecraft.util.math.Vec2f类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GerritServerConfig类代码示例发布时间:2022-05-22
下一篇:
Java DynamicDestinationResolver类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap