Java Code Examples for net.minecraft.block.Block#getBlockBoundsMaxZ()

The following examples show how to use net.minecraft.block.Block#getBlockBoundsMaxZ() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GeneralChiselClient.java    From Chisel-2 with GNU General Public License v2.0 4 votes vote down vote up
public static EntityDiggingFX addBlockHitEffects(World world, int x, int y, int z, int side) {
	Block block = world.getBlock(x, y, z);
	if (block.isAir(world, x, y, z) || Minecraft.getMinecraft().gameSettings.particleSetting != 0)
		return null;

	EffectRenderer renderer = Minecraft.getMinecraft().effectRenderer;

	float f = 0.1F;
	double d0 = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - f * 2.0F) + f + block.getBlockBoundsMinX();
	double d1 = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - f * 2.0F) + f + block.getBlockBoundsMinY();
	double d2 = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - f * 2.0F) + f + block.getBlockBoundsMinZ();

	switch (side) {
	case 0:
		d1 = y + block.getBlockBoundsMinY() - f;
		break;
	case 1:
		d1 = y + block.getBlockBoundsMaxY() + f;
		break;
	case 2:
		d2 = z + block.getBlockBoundsMinZ() - f;
		break;
	case 3:
		d2 = z + block.getBlockBoundsMaxZ() + f;
		break;
	case 4:
		d0 = x + block.getBlockBoundsMinX() - f;
		break;
	case 5:
		d0 = x + block.getBlockBoundsMaxX() + f;
		break;
	}

	EntityDiggingFX res = new EntityDiggingFX(world, d0, d1, d2, 0.0D, 0.0D, 0.0D, block, world.getBlockMetadata(x, y, z), side);
	res.motionX = d0 - (x + 0.5);
	res.motionY = d1 - (y + 0.5);
	res.motionZ = d2 - (z + 0.5);

	renderer.addEffect(res);

	return res;
}
 
Example 2
Source File: GeneralChiselClient.java    From Chisel with GNU General Public License v2.0 4 votes vote down vote up
public static EntityDiggingFX addBlockHitEffects(World world, int x, int y, int z, int side)
    {
        Block block = world.getBlock(x, y, z);
        if(block.isAir(world, x, y, z))
            return null;

        EffectRenderer renderer = Minecraft.getMinecraft().effectRenderer;

        float f = 0.1F;
        double d0 = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - f * 2.0F) + f + block.getBlockBoundsMinX();
        double d1 = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - f * 2.0F) + f + block.getBlockBoundsMinY();
        double d2 = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - f * 2.0F) + f + block.getBlockBoundsMinZ();

        switch(side)
        {
            case 0:
                d1 = y + block.getBlockBoundsMinY() - f;
                break;
            case 1:
                d1 = y + block.getBlockBoundsMaxY() + f;
                break;
            case 2:
                d2 = z + block.getBlockBoundsMinZ() - f;
                break;
            case 3:
                d2 = z + block.getBlockBoundsMaxZ() + f;
                break;
            case 4:
                d0 = x + block.getBlockBoundsMinX() - f;
                break;
            case 5:
                d0 = x + block.getBlockBoundsMaxX() + f;
                break;
        }

        EntityDiggingFX res = new EntityDiggingFX(world, d0, d1, d2, 0.0D, 0.0D, 0.0D, block, world.getBlockMetadata(x, y, z), side);
//		res.func_70596_a(x, y, z);
        res.motionX = d0 - (x + 0.5);
        res.motionY = d1 - (y + 0.5);
        res.motionZ = d2 - (z + 0.5);

        renderer.addEffect(res);

        return res;
    }
 
Example 3
Source File: RenderBlockArrows.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
public void render(World world, int x, int y, int z, float partialTicks){
    // if(true) return;
    Block block = world.getBlock(x, y, z);
    block.setBlockBoundsBasedOnState(world, x, y, z);
    double minX = block.getBlockBoundsMinX();
    double minY = block.getBlockBoundsMinY();
    double minZ = block.getBlockBoundsMinZ();
    double maxX = block.getBlockBoundsMaxX();
    double maxY = block.getBlockBoundsMaxY();
    double maxZ = block.getBlockBoundsMaxZ();
    if(ticksExisted > 10) ticksExisted = 0;
    float progress = (ticksExisted + partialTicks) / 10F;
    GL11.glLineWidth(1.0F);
    GL11.glColor4d(1, 1, 1, progress);
    GL11.glPushMatrix();
    GL11.glTranslated(-0.5D, -0.5D, -0.5D);

    GL11.glPushMatrix();
    GL11.glTranslated(minX, minY, minZ);
    GL11.glRotatef(45, 0, 1, 0);
    GL11.glRotatef(45, 1, 0, 0);
    drawArrow(progress);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(maxX, minY, minZ);
    GL11.glRotatef(45, 0, -1, 0);
    GL11.glRotatef(45, 1, 0, 0);
    drawArrow(progress);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(minX, minY, maxZ);
    GL11.glRotatef(45, 0, -1, 0);
    GL11.glRotatef(45, -1, 0, 0);
    drawArrow(progress);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(maxX, minY, maxZ);
    GL11.glRotatef(45, 0, 1, 0);
    GL11.glRotatef(45, -1, 0, 0);
    drawArrow(progress);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(minX, maxY, minZ);
    GL11.glRotatef(45, 0, 1, 0);
    GL11.glRotatef(135, 1, 0, 0);
    drawArrow(progress);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(maxX, maxY, minZ);
    GL11.glRotatef(45, 0, -1, 0);
    GL11.glRotatef(135, 1, 0, 0);
    drawArrow(progress);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(minX, maxY, maxZ);
    GL11.glRotatef(45, 0, -1, 0);
    GL11.glRotatef(135, -1, 0, 0);
    drawArrow(progress);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(maxX, maxY, maxZ);
    GL11.glRotatef(45, 0, 1, 0);
    GL11.glRotatef(135, -1, 0, 0);
    drawArrow(progress);
    GL11.glPopMatrix();

    GL11.glPopMatrix();
}