本文整理汇总了Java中net.minecraft.util.Vec3i类的典型用法代码示例。如果您正苦于以下问题:Java Vec3i类的具体用法?Java Vec3i怎么用?Java Vec3i使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Vec3i类属于net.minecraft.util包,在下文中一共展示了Vec3i类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderModelBrightnessColorQuads
import net.minecraft.util.Vec3i; //导入依赖的package包/类
private void renderModelBrightnessColorQuads(float p_178264_1_, float p_178264_2_, float p_178264_3_, float p_178264_4_, List<BakedQuad> p_178264_5_)
{
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
for (BakedQuad bakedquad : p_178264_5_)
{
worldrenderer.begin(7, DefaultVertexFormats.ITEM);
worldrenderer.addVertexData(bakedquad.getVertexData());
if (bakedquad.hasTintIndex())
{
worldrenderer.putColorRGB_F4(p_178264_2_ * p_178264_1_, p_178264_3_ * p_178264_1_, p_178264_4_ * p_178264_1_);
}
else
{
worldrenderer.putColorRGB_F4(p_178264_1_, p_178264_1_, p_178264_1_);
}
Vec3i vec3i = bakedquad.getFace().getDirectionVec();
worldrenderer.putNormal((float)vec3i.getX(), (float)vec3i.getY(), (float)vec3i.getZ());
tessellator.draw();
}
}
示例2: renderModelBrightnessColorQuads
import net.minecraft.util.Vec3i; //导入依赖的package包/类
private void renderModelBrightnessColorQuads(float p_178264_1_, float p_178264_2_, float p_178264_3_, float p_178264_4_, List p_178264_5_)
{
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
for (Object bakedquad0 : p_178264_5_)
{
BakedQuad bakedquad = (BakedQuad)bakedquad0;
worldrenderer.begin(7, DefaultVertexFormats.ITEM);
worldrenderer.addVertexData(bakedquad.getVertexData());
if (bakedquad.hasTintIndex())
{
worldrenderer.putColorRGB_F4(p_178264_2_ * p_178264_1_, p_178264_3_ * p_178264_1_, p_178264_4_ * p_178264_1_);
}
else
{
worldrenderer.putColorRGB_F4(p_178264_1_, p_178264_1_, p_178264_1_);
}
Vec3i vec3i = bakedquad.getFace().getDirectionVec();
worldrenderer.putNormal((float)vec3i.getX(), (float)vec3i.getY(), (float)vec3i.getZ());
tessellator.draw();
}
}
示例3: renderModelBrightnessColorQuads
import net.minecraft.util.Vec3i; //导入依赖的package包/类
private void renderModelBrightnessColorQuads(float p_178264_1_, float p_178264_2_, float p_178264_3_, float p_178264_4_, List p_178264_5_)
{
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
for (Object bakedquad0 : p_178264_5_)
{
BakedQuad bakedquad = (BakedQuad) bakedquad0;
worldrenderer.begin(7, DefaultVertexFormats.ITEM);
worldrenderer.addVertexData(bakedquad.getVertexData());
if (bakedquad.hasTintIndex())
{
worldrenderer.putColorRGB_F4(p_178264_2_ * p_178264_1_, p_178264_3_ * p_178264_1_, p_178264_4_ * p_178264_1_);
}
else
{
worldrenderer.putColorRGB_F4(p_178264_1_, p_178264_1_, p_178264_1_);
}
Vec3i vec3i = bakedquad.getFace().getDirectionVec();
worldrenderer.putNormal((float)vec3i.getX(), (float)vec3i.getY(), (float)vec3i.getZ());
tessellator.draw();
}
}
示例4: renderTileEntityAt
import net.minecraft.util.Vec3i; //导入依赖的package包/类
@Override
public void renderTileEntityAt(TileEntity t, double x, double y, double z, float f, int i) {
TileEntity_Railing tile = (TileEntity_Railing) t;
if (!tile.isInvalid()) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y-1, z + 0.5);
bindTexture(texture);
Block right = tile.getWorld().getBlockState(tile.getPos().add(new Vec3i(1,-1,0))).getBlock();
Block left = tile.getWorld().getBlockState(tile.getPos().add(new Vec3i(-1,0,0))).getBlock();
Block front = tile.getWorld().getBlockState(tile.getPos().add(new Vec3i(0,0,1))).getBlock();
Block back = tile.getWorld().getBlockState(tile.getPos().add(new Vec3i(0,0,-1))).getBlock();
if(!(left instanceof BlockAir)&&!(left instanceof Block_Railing)){
model.renderPart("left");
}else
if(!(right instanceof BlockAir)&&!(right instanceof Block_Railing)){
model.renderPart("right");
}else
model.renderPart("middle");
GL11.glPopMatrix();
}
}
示例5: renderModelAt
import net.minecraft.util.Vec3i; //导入依赖的package包/类
public void renderModelAt(TileEntity_TV tile, double x, double y, double z, float f) {
glPushMatrix();
glDisable(GL_CULL_FACE);
glEnable(GL_ALPHA_TEST);
Block b = tile.getWorld().getBlockState(tile.getPos().subtract(new Vec3i(0, 1, 0))).getBlock();
glTranslatef((float) x + 0.5f, (float) y, (float) z + 0.5f);
if (b instanceof Block_TVTable) {
glTranslatef(0, -0.5f, 0);
}
glRotatef(tile.rotation * 90, 0.0F, 1.0F, 0.0F);
if (tile.rotation == 0 || tile.rotation == 2) {
glRotatef(180, 0.0F, 1.0F, 0.0F);
}
this.bindTexture(texture);
this.model.renderAll();
glPopMatrix();
}
示例6: randomDisplayTick
import net.minecraft.util.Vec3i; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@Override
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
super.randomDisplayTick(worldIn, pos, state, rand);
TileEntity_Lantern tile = (TileEntity_Lantern) worldIn.getTileEntity(pos);
if (tile.isActive) {
this.isBurning = true;
setLightLevel(10.0f);
} else {
setLightLevel(0);
isBurning = false;
}
worldIn.markBlockForUpdate(pos);
worldIn.markBlockRangeForRenderUpdate(pos.subtract(new Vec3i(-5,0,-5)), pos.add(5,0,5));
worldIn.notifyNeighborsOfStateChange(pos, this);
}
示例7: placeDoor
import net.minecraft.util.Vec3i; //导入依赖的package包/类
/**
* Actually places the door; use after determining door side for best results
*/
private void placeDoor(World world, Random rand) {
Vec3i center = bBox.getCenter();
int x = center.getX();
int y = bBox.minY + (submerged ? 2 : 1);
int z = center.getZ();
switch(face) {
case SOUTH: z = bBox.maxZ; break;
case NORTH: z = bBox.minZ; break;
case EAST: x = bBox.maxX; break;
case WEST: x = bBox.minX; break;
default: // UP and DOWN not possible
}
world.setBlockState(new BlockPos(x, y, z), door.getStateFromMeta(doorMeta), 2);
doorMeta = (door instanceof BlockDoorLocked ? (doorMeta | 8) : doorMeta); // upper part of door
world.setBlockState(new BlockPos(x, y + 1, z), (door instanceof BlockPeg ? Blocks.air.getDefaultState() : door.getStateFromMeta(doorMeta)), 2);
}
示例8: placeDoor
import net.minecraft.util.Vec3i; //导入依赖的package包/类
/**
* Actually places the door; use after determining door side for best results
*/
protected void placeDoor(World world) {
Vec3i center = bBox.getCenter();
int x = center.getX();
int y = bBox.minY + (submerged ? 2 : 1);
int z = center.getZ();
switch(doorSide) {
case SOUTH: z = bBox.maxZ; break;
case NORTH: z = bBox.minZ; break;
case EAST: x = bBox.maxX; break;
case WEST: x = bBox.minX; break;
default: ZSSMain.logger.warn("Placing Boss door with invalid door side");
}
world.setBlockState(new BlockPos(x, y, z), ZSSBlocks.doorBoss.getStateFromMeta(type.ordinal() & ~0x8), 2);
world.setBlockState(new BlockPos(x, y + 1, z), ZSSBlocks.doorBoss.getStateFromMeta(type.ordinal() | 0x8), 2);
}
示例9: placeMainChest
import net.minecraft.util.Vec3i; //导入依赖的package包/类
/**
* Places and generates the contents of this dungeon's main chest
*/
protected void placeMainChest(World world, Random rand, boolean inCenter) {
Vec3i center = bBox.getCenter();
int x = (inCenter ? center.getX() : (rand.nextFloat() < 0.5F ? bBox.minX + 1 : bBox.maxX - 1));
int y = bBox.minY + (inCenter ? 2 : 1) + (submerged && !inOcean ? 1 : 0);
int z = (inCenter ? center.getZ() : (rand.nextFloat() < 0.5F ? bBox.minZ + 1 : bBox.maxZ - 1));
BlockPos pos = new BlockPos(x, y, z);
Block chest = (inCenter ? Blocks.chest : ZSSBlocks.chestLocked);
placeChest(world, pos, chest);
if (inCenter) {
world.setBlockState(pos, chest.getStateFromMeta(doorSide.getIndex()), 2);
} else if (submerged && !inOcean) {
world.setBlockState(pos.down(), BlockSecretStone.EnumType.byMetadata(getMetadata()).getDroppedBlock().getDefaultState(), 2);
}
TileEntity te = world.getTileEntity(pos);
if (te instanceof IInventory) {
DungeonLootLists.generateBossChestContents(world, rand, (IInventory) te, this);
}
}
示例10: placeInOcean
import net.minecraft.util.Vec3i; //导入依赖的package包/类
@Override
protected boolean placeInOcean(World world, boolean sink) {
if (type == BossType.OCEAN) {
Vec3i center = bBox.getCenter();
while (bBox.minY > 60 && world.getBlockState(new BlockPos(center.getX(), bBox.minY, center.getZ())).getBlock().getMaterial() == Material.air) {
bBox.offset(0, -1, 0);
}
while (bBox.minY > 16 && world.getBlockState(new BlockPos(center.getX(), bBox.minY, center.getZ())).getBlock().getMaterial() == Material.water) {
bBox.offset(0, -1, 0);
}
if (world.getBlockState(new BlockPos(center.getX(), bBox.minY, center.getZ())).getBlock().getMaterial() != Material.water &&
world.getBlockState(new BlockPos(center.getX(), bBox.maxY, center.getZ())).getBlock().getMaterial() == Material.water) {
inOcean = true;
submerged = true;
StructureGenUtils.adjustCornersForMaterial(world, bBox, Material.water, 6, false, false);
return true;
}
}
return false;
}
示例11: onUpdateTick
import net.minecraft.util.Vec3i; //导入依赖的package包/类
@Override
protected void onUpdateTick(World world) {
int nextUpdate = 10;
int x = box.minX + world.rand.nextInt(box.getXSize() - 1) + 1;
int y = box.maxY - 1;
int z = box.minZ + world.rand.nextInt(box.getZSize() - 1) + 1;
Vec3i center = box.getCenter();
if (Math.abs(center.getX() - x) > 1 && Math.abs(center.getZ() - z) > 1) {
EntityBomb bomb = new EntityBomb(world).setDestructionFactor(0.7F).addTime((3 - difficulty) * 16);
bomb.setPosition(x, y, z);
if (world.isAirBlock(new BlockPos(x, box.minY, z))) {
bomb.setNoGrief();
}
if (world.getCollidingBoundingBoxes(bomb, bomb.getEntityBoundingBox()).isEmpty()) {
if (!world.isRemote) {
world.playSoundEffect(x, y, z, Sounds.BOMB_WHISTLE, 1.0F, 1.0F);
world.spawnEntityInWorld(bomb);
nextUpdate = ((3 - difficulty) * 100) + 50 + world.rand.nextInt(400);
}
}
}
scheduleUpdateTick(nextUpdate);
}
示例12: destroyRandomPillar
import net.minecraft.util.Vec3i; //导入依赖的package包/类
/**
* Destroys part of a random pillar during boss event
* @param explode whether a difficulty-scaled explosion should be created as well
*/
protected void destroyRandomPillar(World world, boolean explode) {
Vec3i center = box.getCenter();
int corner = world.rand.nextInt(4);
int offset = (box.getXSize() < 11 ? 2 : 3);
int x = (corner < 2 ? ((box.getXSize() < 11 ? center.getX() : box.minX) + offset)
: ((box.getXSize() < 11 ? center.getX() : box.maxX) - offset));
int y = box.minY + (world.rand.nextInt(3) + 1);
int z = (corner % 2 == 0 ? ((box.getZSize() < 11 ? center.getZ() : box.minZ) + offset)
: ((box.getZSize() < 11 ? center.getZ() : box.maxZ) - offset));
if (!world.isAirBlock(new BlockPos(x, y, z))) {
if (explode) {
float radius = 1.5F + (float)(difficulty * 0.5F);
CustomExplosion.createExplosion(world, x, y, z, radius, BombType.BOMB_STANDARD);
}
world.playSoundEffect(x + 0.5D, center.getY(), z + 0.5D, Sounds.ROCK_FALL, 1.0F, 1.0F);
StructureGenUtils.destroyBlocksAround(world, x - 1, x + 2, y, box.maxY - 2, z - 1, z + 2, null, false);
}
}
示例13: generateAncientTablet
import net.minecraft.util.Vec3i; //导入依赖的package包/类
/**
* Called from {@link #endCrisis} to attempt to generate an Ancient Tablet
*/
protected void generateAncientTablet(World world) {
if (world.rand.nextFloat() < 1.0F) { // TODO Config.getAncientTabletGenChance()
// Attempt to find a valid block position n times
BlockPos pos = null;
// TODO allow tablet to spawn up to several chunks away?
for (int n = 0; n < 4 && pos == null; ++n) {
pos = getRandomPlaceablePosition(world, ZSSBlocks.ancientTablet, box.minX + 1, box.maxY + 1, box.minZ + 1, box.getXSize() - 1, 1, box.getZSize() - 1);
}
if (pos != null) {
BlockAncientTablet.EnumType type = BlockAncientTablet.EnumType.byMetadata(world.rand.nextInt(BlockAncientTablet.EnumType.values().length));
EnumFacing facing = (world.rand.nextInt(2) == 0 ? EnumFacing.SOUTH : EnumFacing.EAST);
world.setBlockState(pos, ZSSBlocks.ancientTablet.getDefaultState().withProperty(BlockAncientTablet.VARIANT, type).withProperty(BlockAncientTablet.FACING, facing));
world.playSoundEffect(pos.getX(), pos.getY(), pos.getZ(), Sounds.ROCK_FALL, 1.0F, 1.0F);
Vec3i center = box.getCenter();
EntityPlayer player = world.getClosestPlayer(center.getX(), center.getY(), center.getZ(), 16.0D);
if (player != null) {
new TimedChatDialogue(player, 1250, 1250, new ChatComponentTranslation("chat.zss.ancient_tablet.spawn"));
}
}
}
}
示例14: placeOpenDoor
import net.minecraft.util.Vec3i; //导入依赖的package包/类
/**
* Sets 2 air blocks where door used to be, after dungeon defeated
* @param dy Amount to adjust y position above box.minY; usually either 1 or 2
*/
private void placeOpenDoor(int dy) {
if (doorSide == null) {
doorSide = EnumFacing.EAST;
}
Vec3i center = box.getCenter();
int x = center.getX();
int z = center.getZ();
switch(doorSide) {
case SOUTH: z = box.maxZ; break;
case NORTH: z = box.minZ; break;
case EAST: x = box.maxX; break;
case WEST: x = box.minX; break;
default: // UP and DOWN not possible
}
worldObj.setBlockToAir(new BlockPos(x, box.minY + dy, z));
worldObj.setBlockToAir(new BlockPos(x, box.minY + dy + 1, z));
}
示例15: getAverageDistanceToGround
import net.minecraft.util.Vec3i; //导入依赖的package包/类
/**
* Returns average distance to ground based on 5 points in bounding box's lowest layer
* @param max if any distance exceeds this threshold, this value will be returned
*/
public static int getAverageDistanceToGround(World world, StructureBoundingBox box, int max) {
Vec3i center = box.getCenter();
int i = getDistanceToGround(world, center.getX(), box.minY, center.getZ());
int total = i;
if (i > max) { return max; }
i = getDistanceToGround(world, box.minX, box.minY, box.minZ);
total += i;
if (i > max) { return max; }
i = getDistanceToGround(world, box.minX, box.minY, box.maxZ);
total += i;
if (i > max) { return max; }
i = getDistanceToGround(world, box.maxX, box.minY, box.minZ);
total += i;
if (i > max) { return max; }
i = getDistanceToGround(world, box.maxX, box.minY, box.maxZ);
total += i;
if (i > max) { return max; }
return total / 5;
}