net.minecraft.util.EnumFacing#getFrontOffsetY ( )源码实例Demo

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

源代码1 项目: GregTech   文件: RecipeLogicSteam.java
protected void tryDoVenting() {
    BlockPos machinePos = metaTileEntity.getPos();
    EnumFacing ventingSide = getVentingSide();
    BlockPos ventingBlockPos = machinePos.offset(ventingSide);
    IBlockState blockOnPos = metaTileEntity.getWorld().getBlockState(ventingBlockPos);
    if (blockOnPos.getCollisionBoundingBox(metaTileEntity.getWorld(), ventingBlockPos) == Block.NULL_AABB) {
        metaTileEntity.getWorld()
            .getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(ventingBlockPos), EntitySelectors.CAN_AI_TARGET)
            .forEach(entity -> entity.attackEntityFrom(DamageSources.getHeatDamage(), 6.0f));
        WorldServer world = (WorldServer) metaTileEntity.getWorld();
        double posX = machinePos.getX() + 0.5 + ventingSide.getFrontOffsetX() * 0.6;
        double posY = machinePos.getY() + 0.5 + ventingSide.getFrontOffsetY() * 0.6;
        double posZ = machinePos.getZ() + 0.5 + ventingSide.getFrontOffsetZ() * 0.6;

        world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, posX, posY, posZ,
            7 + world.rand.nextInt(3),
            ventingSide.getFrontOffsetX() / 2.0,
            ventingSide.getFrontOffsetY() / 2.0,
            ventingSide.getFrontOffsetZ() / 2.0, 0.1);
        world.playSound(null, posX, posY, posZ, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1.0f, 1.0f);
        setNeedsVenting(false);
    } else if (!ventingStuck) {
        setVentingStuck(true);
    }
}
 
源代码2 项目: Artifacts   文件: DispenserBehaviorFireball.java
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
    EnumFacing enumfacing = BlockTrap.getFacing(par1IBlockSource.getBlockMetadata());
    IPosition iposition = BlockTrap.getIPositionFromBlockSource(par1IBlockSource);
    double d0 = iposition.getX() + (double)((float)enumfacing.getFrontOffsetX() * 0.3F);
    double d1 = iposition.getY() + (double)((float)enumfacing.getFrontOffsetX() * 0.3F);
    double d2 = iposition.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 0.3F);
    World world = par1IBlockSource.getWorld();
    Random random = world.rand;
    double d3 = random.nextGaussian() * 0.05D + (double)enumfacing.getFrontOffsetX();
    double d4 = random.nextGaussian() * 0.05D + (double)enumfacing.getFrontOffsetY();
    double d5 = random.nextGaussian() * 0.05D + (double)enumfacing.getFrontOffsetZ();
    world.spawnEntityInWorld(new EntitySmallFireball(world, d0, d1, d2, d3, d4, d5));
    par2ItemStack.splitStack(1);
    return par2ItemStack;
}
 
源代码3 项目: Artifacts   文件: DispenserBehaviorMobEgg.java
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
    EnumFacing enumfacing = BlockDispenser.func_149937_b/*getFacing*/(par1IBlockSource.getBlockMetadata());
    double d0 = par1IBlockSource.getX() + (double)enumfacing.getFrontOffsetX();
    double d1 = (double)((float)par1IBlockSource.getYInt() + 0.2F) + enumfacing.getFrontOffsetY();
    double d2 = par1IBlockSource.getZ() + (double)enumfacing.getFrontOffsetZ();
    Entity entity = ItemMonsterPlacer.spawnCreature(par1IBlockSource.getWorld(), par2ItemStack.getItemDamage(), d0, d1, d2);

    if (entity instanceof EntityLiving && par2ItemStack.hasDisplayName())
    {
        ((EntityLiving)entity).setCustomNameTag(par2ItemStack.getDisplayName());
    }

    par2ItemStack.splitStack(1);
    return par2ItemStack;
}
 
源代码4 项目: GregTech   文件: ShapeModelGenerator.java
public static CCModel[] generateRotatedVariants(CCModel originalModel) {
    CCModel[] result = new CCModel[6];
    double modelHeight = originalModel.verts[2].vec.y;
    double translate = 1.0 - modelHeight;
    for (int i = 0; i < 3; i++) {
        EnumFacing side = EnumFacing.VALUES[i * 2 + 1];
        Transformation rotation = Rotation.sideRotations[i * 2].at(Vector3.center);
        Transformation translation = new Translation(side.getFrontOffsetX() * translate, side.getFrontOffsetY() * translate, side.getFrontOffsetZ() * translate);
        CCModel negativeModel = originalModel.copy().apply(rotation);
        CCModel positiveModel = negativeModel.copy().apply(translation);
        result[i * 2] = negativeModel;
        result[i * 2 + 1] = positiveModel;
    }
    return result;
}
 
源代码5 项目: Production-Line   文件: ItemPLTreetap.java
private static void ejectResin(World world, BlockPos pos, EnumFacing side, int quantity) {
    double ejectBias = 0.3D;
    double ejectX = (double) pos.getX() + 0.5D + (double) side.getFrontOffsetX() * 0.3D;
    double ejectY = (double) pos.getY() + 0.5D + (double) side.getFrontOffsetY() * 0.3D;
    double ejectZ = (double) pos.getZ() + 0.5D + (double) side.getFrontOffsetZ() * 0.3D;

    for (int i = 0; i < quantity; ++i) {
        EntityItem entityitem = new EntityItem(world, ejectX, ejectY, ejectZ, ItemName.misc_resource.getItemStack(MiscResourceType.resin));
        entityitem.setDefaultPickupDelay();
        world.spawnEntity(entityitem);
    }

}
 
@Override
public boolean shouldSideBeRendered(IBlockState blockState,
		IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
	
	if(side.getFrontOffsetY() != 0) {
		if(blockAccess.getBlockState(pos).getBlock() == this)
		return true;
	}
	
	return super.shouldSideBeRendered(blockState, blockAccess, pos, side);
}
 
源代码7 项目: AdvancedRocketry   文件: StorageChunk.java
@Override
public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) {
	int x = pos.getX();
	int y = pos.getY();
	int z = pos.getZ();
	if(x < 0 || x >= sizeX || y < 0 || y >= sizeY || z < 0 || z >= sizeZ  || x + side.getFrontOffsetX() < 0 
			|| x + side.getFrontOffsetX() >= sizeX || y + side.getFrontOffsetY() < 0 || y + side.getFrontOffsetY() >= sizeY 
			|| z + side.getFrontOffsetZ() < 0 || z + side.getFrontOffsetZ() >= sizeZ)
		return false;

	return blocks[x + side.getFrontOffsetX()][y + side.getFrontOffsetY()][z + side.getFrontOffsetZ()].isSideSolid(blocks[x + side.getFrontOffsetX()][y + side.getFrontOffsetY()][z + side.getFrontOffsetZ()].getStateFromMeta(metas[x + side.getFrontOffsetX()][y + side.getFrontOffsetY()][z + side.getFrontOffsetZ()]), this, pos.offset(side), side.getOpposite());

}
 
源代码8 项目: OpenModsLib   文件: GeometryUtils.java
private Octant(String friendlyName, EnumFacing dirX, EnumFacing dirY, EnumFacing dirZ) {
	this.x = dirX.getFrontOffsetX() + dirY.getFrontOffsetX() + dirZ.getFrontOffsetX();
	this.y = dirX.getFrontOffsetY() + dirY.getFrontOffsetY() + dirZ.getFrontOffsetY();
	this.z = dirX.getFrontOffsetZ() + dirY.getFrontOffsetZ() + dirZ.getFrontOffsetZ();
	this.dirs = EnumSet.of(dirX, dirY, dirZ);
	this.name = friendlyName;
}
 
源代码9 项目: ExtraCells1   文件: BlockMEDropper.java
public static IPosition getIPositionFromBlockSource(IBlockSource par0IBlockSource)
{
	EnumFacing enumfacing = getFacing(par0IBlockSource.getBlockMetadata());
	double d0 = par0IBlockSource.getX() + 0.7D * enumfacing.getFrontOffsetX();
	double d1 = par0IBlockSource.getY() + 0.7D * enumfacing.getFrontOffsetY();
	double d2 = par0IBlockSource.getZ() + 0.7D * enumfacing.getFrontOffsetZ();
	return new PositionImpl(d0, d1, d2);
}
 
源代码10 项目: Artifacts   文件: BlockTrap.java
public static IPosition getIPositionFromBlockSource(IBlockSource par0IBlockSource)
{
    EnumFacing enumfacing = getFacing(par0IBlockSource.getBlockMetadata());
    double d0 = par0IBlockSource.getX() + 0.7D * (double)enumfacing.getFrontOffsetX();
    double d1 = par0IBlockSource.getY() + 0.7D * (double)enumfacing.getFrontOffsetY();
    double d2 = par0IBlockSource.getZ() + 0.7D * (double)enumfacing.getFrontOffsetZ();
    return new PositionImpl(d0, d1, d2);
}
 
源代码11 项目: Signals   文件: BlockTeleportRail.java
private void teleport(EntityMinecart cart, MCPos destination){
    if(cart instanceof EntityMinecartContainer) {
        ((EntityMinecartContainer)cart).dropContentsWhenDead = false;
    }

    int dimensionIn = destination.getDimID();
    BlockPos destPos = destination.getPos();
    if(!ForgeHooks.onTravelToDimension(cart, destination.getDimID())) return;

    MinecraftServer minecraftserver = cart.getServer();
    int i = cart.dimension;
    WorldServer worldserver = minecraftserver.getWorld(i);
    WorldServer worldserver1 = minecraftserver.getWorld(dimensionIn);
    cart.dimension = dimensionIn;

    /*if (i == 1 && dimensionIn == 1)
    {
        worldserver1 = minecraftserver.getWorld(0);
        this.dimension = 0;
    }*/

    cart.world.removeEntity(cart);
    cart.isDead = false;
    BlockPos blockpos = destination.getPos();

    /* double moveFactor = worldserver.provider.getMovementFactor() / worldserver1.provider.getMovementFactor();
    double d0 = MathHelper.clamp(this.posX * moveFactor, worldserver1.getWorldBorder().minX() + 16.0D, worldserver1.getWorldBorder().maxX() - 16.0D);
    double d1 = MathHelper.clamp(this.posZ * moveFactor, worldserver1.getWorldBorder().minZ() + 16.0D, worldserver1.getWorldBorder().maxZ() - 16.0D);
    double d2 = 8.0D;*/

    cart.moveToBlockPosAndAngles(destPos, 90.0F, 0.0F);
    /*Teleporter teleporter = worldserver1.getDefaultTeleporter();
    teleporter.placeInExistingPortal(this, f);
    blockpos = new BlockPos(this);*/

    worldserver.updateEntityWithOptionalForce(cart, false);
    Entity entity = EntityList.newEntity(cart.getClass(), worldserver1);

    if(entity != null) {
        copyDataFromOld(entity, cart);

        entity.moveToBlockPosAndAngles(blockpos, entity.rotationYaw, entity.rotationPitch);

        IBlockState state = destination.getLoadedBlockState();
        if(state.getBlock() == ModBlocks.TELEPORT_RAIL) { //If the destination is a teleport track, use its rail direction to push the cart the right direction
            EnumFacing teleportDir = getTeleportDirection(state);
            double speed = 0.2;
            entity.motionX = teleportDir.getFrontOffsetX() * speed;
            entity.motionY = teleportDir.getFrontOffsetY() * speed;
            entity.motionZ = teleportDir.getFrontOffsetZ() * speed;
        } else {
            entity.motionX = entity.motionY = entity.motionZ = 0;
        }

        boolean flag = entity.forceSpawn;
        entity.forceSpawn = true;
        worldserver1.spawnEntity(entity);
        entity.forceSpawn = flag;
        worldserver1.updateEntityWithOptionalForce(entity, false);
    }

    cart.isDead = true;
    worldserver.resetUpdateEntityTick();
    worldserver1.resetUpdateEntityTick();
}
 
源代码12 项目: Et-Futurum   文件: BlockPos.java
public BlockPos offset(EnumFacing facing, int n) {
	return new BlockPos(getX() + facing.getFrontOffsetX() * n, getY() + facing.getFrontOffsetY() * n, getZ() + facing.getFrontOffsetZ() * n);
}
 
源代码13 项目: LunatriusCore   文件: MBlockPos.java
@Override
public MBlockPos offset(final EnumFacing facing, final int n) {
    return new MBlockPos(this.x + facing.getFrontOffsetX() * n, this.y + facing.getFrontOffsetY() * n, this.z + facing.getFrontOffsetZ() * n);
}