本文整理汇总了Java中codechicken.lib.vec.Vector3类的典型用法代码示例。如果您正苦于以下问题:Java Vector3类的具体用法?Java Vector3怎么用?Java Vector3使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Vector3类属于codechicken.lib.vec包,在下文中一共展示了Vector3类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: WirelessBolt
import codechicken.lib.vec.Vector3; //导入依赖的package包/类
public WirelessBolt(World world, Vector3 jammervec, Vector3 targetvec, long seed) {
this.world = world;
this.seed = seed;
this.rand = new Random(seed);
ether = RedstoneEther.get(world.isRemote);
start = jammervec;
end = targetvec;
numsegments0 = 1;
length = end.copy().subtract(start).mag();
particleMaxAge = fadetime + rand.nextInt(fadetime) - (fadetime / 2);
particleAge = -(int) (length * speed);
boundingBox = new AxisAlignedBB(Math.min(start.x, end.x), Math.min(start.y, end.y), Math.min(start.z, end.z),
Math.max(start.x, end.x), Math.max(start.y, end.y), Math.max(start.z, end.z))
.expand(length / 2, length / 2, length / 2);
segments.add(new Segment(start, end));
}
示例2: rayTraceResistance
import codechicken.lib.vec.Vector3; //导入依赖的package包/类
private float rayTraceResistance(Vector3 start, Vector3 end, float prevresistance) {
RayTraceResult hit = world.rayTraceBlocks(start.vec3(), end.vec3());
if (hit == null)
return prevresistance;
if (hit.typeOfHit == Type.BLOCK) {
IBlockState state = world.getBlockState(hit.getBlockPos());
if (state.getBlock().isAir(state, world, hit.getBlockPos()))
return prevresistance;
/*if(Block.blocksList[blockID] instanceof ISpecialResistance)
{
ISpecialResistance isr = (ISpecialResistance) Block.blocksList[blockID];
return prevresistance + (isr.getSpecialExplosionResistance(world, hit.blockX, hit.blockY, hit.blockZ,
start.x, start.y, start.z, wrapper) + 0.3F);
}
else
{*/
return prevresistance + state.getBlock().getExplosionResistance(wrapper) + 0.3F;
//}
}
return prevresistance;
}
示例3: vecBBDamageSegment
import codechicken.lib.vec.Vector3; //导入依赖的package包/类
private void vecBBDamageSegment(Vector3 start, Vector3 end, ArrayList<Entity> entitylist) {
Vec3d start3D = start.vec3();
Vec3d end3D = end.vec3();
for (Iterator<Entity> iterator = entitylist.iterator(); iterator.hasNext(); ) {
Entity entity = iterator.next();
if (entity instanceof EntityLivingBase &&
(entity.getEntityBoundingBox().isVecInside(start3D) || entity.getEntityBoundingBox().isVecInside(end3D))) {
if (entity instanceof EntityPlayer)
entity.attackEntityFrom(WirelessRedstone.damageBolt, playerdamage);
else
entity.attackEntityFrom(WirelessRedstone.damageBolt, entitydamage);
ether.jamEntity((EntityLivingBase) entity, true);
}
}
}
示例4: getClosestJammer
import codechicken.lib.vec.Vector3; //导入依赖的package包/类
public BlockPos getClosestJammer(Vector3 point, int dimension)
{
BlockPos closestjammer = null;
double closestdist = jammerrangePow2;
for(Iterator<BlockPos> iterator = ethers.get(dimension).jammerset.iterator(); iterator.hasNext();)
{
BlockPos jammer = iterator.next();
double distance = pythagorasPow2(jammer, point);
if(distance < closestdist)
{
closestjammer = jammer;
closestdist = distance;
}
}
return closestjammer;
}
示例5: tickTriangs
import codechicken.lib.vec.Vector3; //导入依赖的package包/类
public void tickTriangs() {
for (Entry<String, AddonPlayerInfo> entry : playerInfos.entrySet()) {
EntityPlayer player = ServerUtils.getPlayer(entry.getKey());
for (Integer freq : entry.getValue().triangSet) {
double spinto;
if (!RedstoneEther.server().isFreqOn(freq)) {
spinto = -1;
} else if (isRemoteOn(player, freq)) {
spinto = -2;
} else {
Vector3 strengthvec = getBroadcastVector(player, freq);
if (strengthvec == null)//in another dimension
{
spinto = -2;//spin to a random place
} else {
spinto = (player.rotationYaw + 180) * MathHelper.torad - Math.atan2(-strengthvec.x, strengthvec.z);//spin to the transmitter vec
}
}
WRServerPH.sendTriangAngleTo(player, freq, (float) spinto);
}
}
}
示例6: renderTracker
import codechicken.lib.vec.Vector3; //导入依赖的package包/类
public static void renderTracker(int freq)
{
GlStateManager.disableLighting();
TextureUtils.bindBlockTexture();
CCRenderState ccrs = CCRenderState.instance();
ccrs.reset();
ccrs.startDrawing(7, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL);
ccrs.colour = 0xFFFFFFFF;
model.render(ccrs, new IconTransformation(TextureUtils.getBlockTexture("obsidian")));
ccrs.draw();
Matrix4 pearlMat = RenderUtils.getMatrix(
new Vector3(0, 0.44+RedstoneEther.getSineWave(ClientUtils.getRenderTime(), 7)*0.02, 0),
new Rotation(RedstoneEther.getRotation(ClientUtils.getRenderTime(), freq), new Vector3(0, 1, 0)),
0.04);
TextureUtils.changeTexture("wrcbe:textures/hedronmap.png");
ccrs.startDrawing(4, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL);
ccrs.colour = freq == 0 ? 0xC0C0C0FF : 0xFFFFFFFF;
CCModelLibrary.icosahedron4.render(ccrs, pearlMat);
ccrs.draw();
GlStateManager.enableLighting();
}
示例7: renderItem
import codechicken.lib.vec.Vector3; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public void renderItem(final ItemStack item, final MicroMaterialRegistry.IMicroMaterial material) {
final Vector3 pos = new Vector3(0.5, 0.5, 0.5);
if (PartSphere.faces_inv == null) {
this.calcSphere(0.5, 0.5, PartSphere.faces_inv = new ArrayList<Vertex5[]>());
LogHelper.debug("Calculated faces " + PartSphere.faces_inv.size(), new Object[0]);
}
CCRenderState.setModel((CCRenderState.IVertexSource)this.face);
for (final Vertex5[] f : PartSphere.faces_inv) {
this.face.lcComputed = false;
this.face.verts[0].set(f[0]);
this.face.verts[1].set(f[1]);
this.face.verts[2].set(f[2]);
this.face.verts[3].set(f[3]);
this.face.side = f[0].uv.tex;
material.renderMicroFace(pos, -1, this.getBounds());
}
}
示例8: reloadShape
import codechicken.lib.vec.Vector3; //导入依赖的package包/类
@Override
public void reloadShape() {
final int prevMask = this.connectionMask;
this.centerPart = this.tile().partMap(6);
final double prevSize = this.pipeSize;
this.pipeSize = 0.26;
this.connectionMask = 0;
if (this.centerPart != null) {
if (this.centerPart instanceof ISidedHollowConnect) {
for (int side = 0; side < 6; ++side) {
this.pipeSize = Math.max(this.pipeSize, (((ISidedHollowConnect)this.centerPart).getHollowSize(side) + 1) / 32.0f);
}
}
for (int i = 0; i < 6; ++i) {
for (final Cuboid6 cuboid6 : this.centerPart.getCollisionBoxes()) {
if (cuboid6.intersects(new Cuboid6(this.pipeSize, 0.0, this.pipeSize, 1.0 - this.pipeSize, 0.01, 1.0 - this.pipeSize).apply(Rotation.sideRotations[i].at(new Vector3(0.5, 0.5, 0.5))))) {
this.connectionMask |= 1 << i;
}
}
}
}
if (prevMask != this.connectionMask || prevSize != this.pipeSize) {
this.tile().notifyPartChange((TMultiPart)this);
this.tile().markRender();
}
}
示例9: renderStatic
import codechicken.lib.vec.Vector3; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@Override
public boolean renderStatic(final Vector3 pos, final int pass) {
this.reloadShape();
if (this.mat == null) {
this.mat = MicroMaterialRegistry.getMaterial(this.material);
}
if (this.mat != null && this.mat.canRenderInPass(pass)) {
MicroblockRender.renderCuboid(new Vector3((double)this.x(), (double)this.y(), (double)this.z()), this.mat, pass, this.getRenderBounds(), this.connectionMask);
for (int i = 0; i < 6; ++i) {
if ((this.connectionMask & 1 << i) != 0x0) {
MicroblockRender.renderCuboid(new Vector3((double)this.x(), (double)this.y(), (double)this.z()), this.mat, pass, new Cuboid6(0.5 - this.pipeSize, 0.5 + this.pipeSize, 0.5 - this.pipeSize, 0.5 + this.pipeSize, 1.0, 0.5 + this.pipeSize).apply(Rotation.sideRotations[Facing.oppositeSide[i]].at(new Vector3(0.5, 0.5, 0.5))), 1 << Facing.oppositeSide[i]);
}
}
return true;
}
return false;
}
示例10: renderStatic
import codechicken.lib.vec.Vector3; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@Override
public boolean renderStatic(final Vector3 pos, final int pass) {
this.reloadShape();
if (this.mat == null) {
this.mat = MicroMaterialRegistry.getMaterial(this.material);
}
if (this.mat != null && this.mat.canRenderInPass(pass)) {
MicroblockRender.renderCuboid(new Vector3((double)this.x(), (double)this.y(), (double)this.z()), this.mat, pass, this.getRenderBounds(), 0);
for (int i = 0; i < 6; ++i) {
if ((this.connectionMask & 1 << i) != 0x0) {
MicroblockRender.renderCuboid(new Vector3((double)this.x(), (double)this.y(), (double)this.z()), this.mat, pass, PartFence.renderCuboids1[i], 1 << Facing.oppositeSide[i] | 1 << i);
MicroblockRender.renderCuboid(new Vector3((double)this.x(), (double)this.y(), (double)this.z()), this.mat, pass, PartFence.renderCuboids2[i], 1 << Facing.oppositeSide[i] | 1 << i);
}
}
return true;
}
return false;
}
示例11: onBlockActivated
import codechicken.lib.vec.Vector3; //导入依赖的package包/类
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
if (world.isRemote) {
return true;
}
RayTraceResult hit = RayTracer.retraceBlock(world, player, pos);
TileTranslocator ttrans = (TileTranslocator) world.getTileEntity(pos);
if (hit != null && ttrans != null) {
if (hit.subHit < 6) {
Vector3 vhit = new Vector3(hit.hitVec);
vhit.add(-pos.getX() - 0.5, -pos.getY() - 0.5, -pos.getZ() - 0.5);
vhit.apply(Rotation.sideRotations[hit.subHit % 6].inverse());
if (MathHelper.between(-2 / 16D, vhit.x, 2 / 16D) && MathHelper.between(-2 / 16D, vhit.z, 2 / 16D)) {
hit.subHit += 6;
}
}
return ttrans.attachments[hit.subHit % 6].activate(player, hit.subHit / 6);
}
return false;
}
示例12: getPart
import codechicken.lib.vec.Vector3; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public TMultiPart getPart(final Vector3 pos, final Cuboid6 bounds) {
final World world = XUHelperClient.clientWorld();
final TileMultipart t = TileMultipart.getOrConvertTile(world, new BlockCoord(pos));
if (t == null) {
return null;
}
for (final TMultiPart part : t.jPartList()) {
if (part instanceof JNormalOcclusion) {
for (final Cuboid6 bound : ((JNormalOcclusion)part).getOcclusionBoxes()) {
if (bound.intersects(bounds)) {
return part;
}
}
}
}
return null;
}
示例13: expandToInclude
import codechicken.lib.vec.Vector3; //导入依赖的package包/类
public Cuboid6 expandToInclude(final Cuboid6 a, final Vector3 v) {
if (a.min.x > v.x) {
a.min.x = v.x;
}
if (a.min.y > v.y) {
a.min.y = v.y;
}
if (a.min.z > v.z) {
a.min.z = v.z;
}
if (a.max.y < v.y) {
a.max.y = v.y;
}
if (a.max.x < v.x) {
a.max.x = v.x;
}
if (a.max.z < v.z) {
a.max.z = v.z;
}
return a;
}
示例14: drawHighlight
import codechicken.lib.vec.Vector3; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public boolean drawHighlight(final MovingObjectPosition hit, final EntityPlayer player, final float frame) {
GL11.glEnable(3042);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glColor4f(0.0f, 0.0f, 0.0f, 0.4f);
GL11.glLineWidth(2.0f);
GL11.glDisable(3553);
GL11.glDepthMask(false);
final float f1 = 0.002f;
final double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * frame;
final double d2 = player.lastTickPosY + (player.posY - player.lastTickPosY) * frame;
final double d3 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * frame;
RenderGlobal.drawOutlinedBoundingBox(this.getBounds().add(new Vector3((double)this.x(), (double)this.y(), (double)this.z())).toAABB().expand((double)f1, (double)f1, (double)f1).getOffsetBoundingBox(-d0, -d2, -d3), -1);
GL11.glDepthMask(true);
GL11.glEnable(3553);
GL11.glDisable(3042);
return true;
}
示例15: getPath
import codechicken.lib.vec.Vector3; //导入依赖的package包/类
public static Vector3 getPath(int src, int dst, double d) {
Vector3 v;
if ((src ^ 1) == dst)//opposite
{
v = sideVec[src ^ 1].copy().multiply(d);
} else {
Vector3 vsrc = sideVec[src ^ 1];
Vector3 vdst = sideVec[dst ^ 1];
Vector3 a = vsrc.copy().multiply(5 / 16D);
Vector3 b = vdst.copy().multiply(6 / 16D);
double sind = MathHelper.sin(d * Math.PI / 2);
double cosd = MathHelper.cos(d * Math.PI / 2);
v = a.multiply(sind).add(b.multiply(cosd - 1)).add(vsrc.copy().multiply(3 / 16D));
}
return v.add(sidePos[src]);
}