本文整理汇总了Java中net.minecraft.util.math.BlockPos.MutableBlockPos.setPos方法的典型用法代码示例。如果您正苦于以下问题:Java MutableBlockPos.setPos方法的具体用法?Java MutableBlockPos.setPos怎么用?Java MutableBlockPos.setPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.util.math.BlockPos.MutableBlockPos
的用法示例。
在下文中一共展示了MutableBlockPos.setPos方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mutLocalToGlobal
import net.minecraft.util.math.BlockPos.MutableBlockPos; //导入方法依赖的package包/类
public static void mutLocalToGlobal(MutableBlockPos local,
BlockPos global,
EnumFacing orientation, boolean ismirrored,
BlockPos strucSize)
{
final int rotIndex = orientation.ordinal()-2;
if (rotIndex < 0 || rotIndex > 3) return; //should not happen. who screwed up
if (ismirrored)
{
mutSetX(local, local.getX() * -1);
if (strucSize.getX() % 2 == 0) mutSetX(local, 1 + local.getX());
}
final int rx = rotationMatrix[rotIndex][0][0] * local.getX() + rotationMatrix[rotIndex][0][1] * local.getZ();
final int rz = rotationMatrix[rotIndex][1][0] * local.getX() + rotationMatrix[rotIndex][1][1] * local.getZ();
local.setPos(
global.getX() + rx,
global.getY() + local.getY(),
global.getZ() + rz
);
}
示例2: getOffsetPosition
import net.minecraft.util.math.BlockPos.MutableBlockPos; //导入方法依赖的package包/类
/**
* Returns the MutableBlockPos <b>pos</b> with a position set to <b>posReference</b> offset by <b>amount</b> in the direction <b>side</b>.
*/
public static MutableBlockPos getOffsetPosition(MutableBlockPos pos, BlockPos posReference, EnumFacing side, int amount)
{
switch (side)
{
case NORTH:
pos.setPos(posReference.getX(), posReference.getY(), posReference.getZ() - amount);
case SOUTH:
pos.setPos(posReference.getX(), posReference.getY(), posReference.getZ() + amount);
case EAST:
pos.setPos(posReference.getX() + amount, posReference.getY(), posReference.getZ());
case WEST:
pos.setPos(posReference.getX() - amount, posReference.getY(), posReference.getZ());
case UP:
pos.setPos(posReference.getX(), posReference.getY() + amount, posReference.getZ());
case DOWN:
pos.setPos(posReference.getX(), posReference.getY() - amount, posReference.getZ());
}
return pos;
}
示例3: mutOffset
import net.minecraft.util.math.BlockPos.MutableBlockPos; //导入方法依赖的package包/类
public static MutableBlockPos mutOffset(MutableBlockPos pos, EnumFacing facing)
{
return pos.setPos(
facing.getFrontOffsetX() + pos.getX(),
facing.getFrontOffsetY() + pos.getY(),
facing.getFrontOffsetZ() + pos.getZ()
);
}
示例4: getLayers
import net.minecraft.util.math.BlockPos.MutableBlockPos; //导入方法依赖的package包/类
public static List<BlockChecker> getLayers(Object[][] config, final Map<Character, MultiblockBlockChecker> materialMap, final World world, final EnumFacing facing, final BlockPos pos) {
List<BlockChecker> list = new ArrayList<>();
final MutableBlockPos corner = new MutableBlockPos(pos);
for (int l = 1;l < config.length;l++) {
final int m = l - 1;
Object[] objA = config[l];
for (int k = 0;k < objA.length;k++) {
Object o = objA[k];
final int n = k;
char[] cA = o.toString().toCharArray();
for (int i = 0;i < cA.length;i++) {
final int j = i;
final char c = cA[i];
if (c == '@') {
corner.setPos(pos.offset(facing.rotateY(), -i).offset(facing, -k).offset(EnumFacing.DOWN, l - 1));
} else if (c == ' ') {
list.add(new BlockChecker(doRun -> AIR.apply(new WorldPos(world, corner.offset(facing.rotateY(), j).offset(facing, n).offset(EnumFacing.UP, m), pos, 0, 0)), 1, c, () -> corner.offset(facing.rotateY(), j).offset(facing, n).offset(EnumFacing.UP, m), m));
} else if (c == '*') {
list.add(new BlockChecker(a -> 2, 2, c, () -> corner.offset(facing.rotateY(), j).offset(facing, n).offset(EnumFacing.UP, m), m));
} else {
list.add(new BlockChecker(doRun -> {
MultiblockBlockChecker predicate = materialMap.get(c);
if (predicate == null)
predicate = AIR;
return predicate.apply(new WorldPos(world, corner.offset(facing.rotateY(), j).offset(facing, n).offset(EnumFacing.UP, m), pos, doRun, m));
}, 0, c, () -> corner.offset(facing.rotateY(), j).offset(facing, n).offset(EnumFacing.UP, m), m));
}
}
}
}
return list;
}
示例5: clampBounds
import net.minecraft.util.math.BlockPos.MutableBlockPos; //导入方法依赖的package包/类
private MutableBlockPos clampBounds(MutableBlockPos bounds)
{
int x = MathHelper.clamp(bounds.getX(), 0, this.maxSize);
int y = MathHelper.clamp(bounds.getY(), 0, this.maxSize);
int z = MathHelper.clamp(bounds.getZ(), 0, this.maxSize);
return bounds.setPos(x, y, z);
}
示例6: setFromPacked
import net.minecraft.util.math.BlockPos.MutableBlockPos; //导入方法依赖的package包/类
private void setFromPacked(MutableBlockPos bounds, int packed)
{
int x = MathHelper.clamp((packed >> 16) & 0xFF, 0, this.maxSize);
int y = MathHelper.clamp((packed >> 8) & 0xFF, 0, this.maxSize);
int z = MathHelper.clamp(packed & 0xFF, 0, this.maxSize);
bounds.setPos(x, y, z);
}
示例7: mutSetX
import net.minecraft.util.math.BlockPos.MutableBlockPos; //导入方法依赖的package包/类
public static void mutSetX(MutableBlockPos pos, int x)
{
pos.setPos(x, pos.getY(), pos.getZ());
}
示例8: mutSetY
import net.minecraft.util.math.BlockPos.MutableBlockPos; //导入方法依赖的package包/类
public static void mutSetY(MutableBlockPos pos, int y)
{
pos.setPos(pos.getX(), y, pos.getZ());
}
示例9: mutSetZ
import net.minecraft.util.math.BlockPos.MutableBlockPos; //导入方法依赖的package包/类
public static void mutSetZ(MutableBlockPos pos, int z)
{
pos.setPos(pos.getX(), pos.getY(), z);
}
示例10: genDecorations
import net.minecraft.util.math.BlockPos.MutableBlockPos; //导入方法依赖的package包/类
@Override
protected void genDecorations(Biome biomeGenBaseIn, World worldIn, Random random)
{
if (this.shouldSpawn(37))
{
this.crystal_island.generate(this.world, this.rand, this.chunkPos.add(this.nextInt(16) + 8, this.nextInt(64) + 32, this.nextInt(16) + 8));
}
if (this.shouldSpawn(3))
{
this.spawnOre(BlocksAether.aether_dirt.getDefaultState(), 32, 20, 128);
}
if (this.shouldSpawn(2))
{
this.getTree().generate(this.world, this.rand, this.world.getHeight(this.chunkPos.add(this.nextInt(16) + 8, 0, this.nextInt(16) + 8)));
}
if (this.shouldSpawn(1))
{
this.skyroot_tree.generate(this.world, this.rand, this.world.getHeight(this.chunkPos.add(this.nextInt(16), 0, this.nextInt(16))));
}
if (AetherConfig.shouldLoadHolidayContent())
{
if (this.shouldSpawn(15))
{
this.holiday_tree.generate(this.world, this.rand, this.world.getHeight(this.chunkPos.add(this.nextInt(16) + 8, 0, this.nextInt(16) + 8)));
}
}
this.generateFoilage(BlocksAether.white_flower.getDefaultState());
this.generateFoilage(BlocksAether.purple_flower.getDefaultState());
this.spawnOre(BlocksAether.icestone.getDefaultState(), 16, 10, 128);
this.spawnOre(BlocksAether.ambrosium_ore.getDefaultState(), 16, 15, 128);
this.spawnOre(BlocksAether.zanite_ore.getDefaultState(), 8, 15, 64);
this.spawnOre(BlocksAether.gravitite_ore.getDefaultState(), 6, 8, 32);
this.generateClouds(EnumCloudType.Golden, 4, false, 50, this.nextInt(64) + 96);
this.generateClouds(EnumCloudType.Blue, 8, false, 26, this.nextInt(64) + 32);
this.generateClouds(EnumCloudType.Cold, 16, false, 14, this.nextInt(64) + 64);
this.generateClouds(EnumCloudType.Cold, 64, true, 50, 0);
MutableBlockPos mutedPos = new MutableBlockPos();
if (this.shouldSpawn(10))
{
for (int x = this.chunkPos.getX(); x < this.chunkPos.getX() + 16; x++)
{
for (int z = this.chunkPos.getZ(); z < this.chunkPos.getZ() + 16; z++)
{
for (int n = 0; n < 48; n++)
{
mutedPos.setPos(x, n, z);
if (this.world.getBlockState(mutedPos).getBlock() == Blocks.AIR && this.world.getBlockState(mutedPos.setPos(x, n + 1, z)).getBlock() == BlocksAether.aether_grass && this.world.getBlockState(mutedPos.setPos(x, n + 2, z)).getBlock() == Blocks.AIR)
{
new AetherGenQuicksoil().generate(this.world, this.rand, mutedPos);
mutedPos.setPos(x, n + 128, z);
}
}
}
}
}
this.generateFoilage(BlocksAether.berry_bush.getDefaultState());
}