Jump to content

[1.10.2] Glitch with custom model


JimiIT92

Recommended Posts

I've created a block using a custom model, to make it looks like is a Tombstone. But in some points the texture used is stretched and it looks awful

WYY3JTT.png

This is the class file

package com.mineworld.blocks.decorations;

import com.mineworld.core.MWBlocks;
import com.mineworld.core.MWTabs;

import net.minecraft.block.Block;
import net.minecraft.block.BlockHorizontal;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;

public class BlockGrave extends BlockHorizontal{

public BlockGrave() {
	super(Material.ROCK, MapColor.STONE);
	this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
	this.setHardness(0.5F);
	this.setCreativeTab(MWTabs.tabDecorations);
	this.setSoundType(SoundType.STONE);
}

/**
     * Used to determine ambient occlusion and culling when rebuilding chunks for render
     */
    public boolean isOpaqueCube(IBlockState state)
    {
        return false;
    }

    public boolean isFullCube(IBlockState state)
    {
        return false;
    }

@Override
public BlockRenderLayer getBlockLayer() {
	return BlockRenderLayer.CUTOUT;
}

/**
     * Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
     * blockstate.
     */
    public IBlockState withRotation(IBlockState state, Rotation rot)
    {
        return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
    }

    /**
     * Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
     * blockstate.
     */
    public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
    {
        return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
    }

    /**
     * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
     * IBlockstate
     */
    public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
    {
        return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
    }

    /**
     * Convert the given metadata into a BlockState for this Block
     */
    public IBlockState getStateFromMeta(int meta)
    {
        return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta));
    }

    /**
     * Convert the BlockState into the correct metadata value
     */
    public int getMetaFromState(IBlockState state)
    {
        return ((EnumFacing)state.getValue(FACING)).getHorizontalIndex();
    }

    protected BlockStateContainer createBlockState()
    {
        return new BlockStateContainer(this, new IProperty[] {FACING});
    }
}

 

And this is the model file

{   "parent": "block/block",
    "textures": {
    "stone": "blocks/stone",
    "particle": "blocks/stone"
     },
    "elements": [
        {   "from": [ 3, 0, 3 ],
            "to": [ 13, 1, 13 ],
            "faces": {
                "down":  { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"},
                "up":    { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"},
                "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"},
                "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"},
                "west":  { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"},
                "east":  { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"}
            }
        },
	{   "from": [ 5, 1, 5],
            "to": [ 11, 2, 11 ],
            "faces": {
                "down":  { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"},
                "up":    { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"},
                "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"},
                "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"},
                "west":  { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"},
                "east":  { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"}
            }
        },
	{   "from": [ 7, 2, 7],
            "to": [ 9, 15, 9 ],
            "faces": {
                "down":  { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"},
                "up":    { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"},
                "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"},
                "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"},
                "west":  { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"},
                "east":  { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"}
            }
        },
	{   "from": [ 4, 9, 7],
            "to": [ 7, 11, 9 ],
            "faces": {
                "down":  { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"},
                "up":    { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"},
                "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"},
                "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"},
                "west":  { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"},
                "east":  { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"}
            }
        }
	,
	{   "from": [ 9, 9, 7],
            "to": [ 12, 11, 9 ],
            "faces": {
                "down":  { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"},
                "up":    { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"},
                "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"},
                "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"},
                "west":  { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"},
                "east":  { "uv": [ 0, 0, 16, 16 ], "texture": "#stone"}
            }
        }
    ]
}

 

How can i make the texture looks "normal" and not "stretched"?

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

Your UVs all state "0 -> 16" for both the U and V directions.  This means the full 16x16 texture is being used on each face.

 

If you want the texture to use as many pixels as the face is wide, then you need to match your UV values to match your from/to values.

 

Also, remove invisible faces.  The cuboid at "from": [ 5, 1, 5],"to": [ 11, 2, 11 ] will never have it's "down" face visible (it is coplanar with the top face of the previous cuboid and facing into it) so there's no reason to render it at all.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Slot BANK BCA adalah pilihan tergacor untuk memulai bermain slot judi Online dimuka bumi saat ini. Jika anda mempunyai BANK BCA, Anda berkesempatan mendapatkan Akun Pro atau ID pro untuk bermain slot. Tunggu apa lagi? Segera daftarkan diri anda sekarang dan dapatkan kemewahan menang maxwin di Museumbola.
    • SLOT SCATTER HITAM : SLOT MAHJONG SCATTER HITAM - MAHJONG WAYS SCATTER HITAM - SLOT PRAGMATIC SCATTER HITAM KLIK DISINI DAFTAR DISINI SLOT VVIP << KLIK DISINI DAFTAR DISINI SLOT VVIP << KLIK DISINI DAFTAR DISINI SLOT VVIP << KLIK DISINI DAFTAR DISINI SLOT VVIP << SITUS SLOT GACOR 88 MAXWIN X500 HARI INI TERBAIK DAN TERPERCAYA GAMPANG MENANG Dunia Game gacor terus bertambah besar seiring berjalannya waktu, dan sudah tentu dunia itu terus berkembang serta merta bersamaan dengan berkembangnya SLOT GACOR sebagai website number #1 yang pernah ada dan tidak pernah mengecewakan sekalipun. Dengan banyaknya member yang sudah mempercayakan untuk terus menghasilkan uang bersama dengan SLOT GACOR pastinya mereka sudah percaya untuk bermain Game online bersama dengan kami dengan banyaknya testimoni yang sudah membuktikan betapa seringnya member mendapatkan jackpot besar yang bisa mencapai ratusan juta rupiah. Best online Game website that give you more money everyday, itu lah slogan yang tepat untuk bermain bersama SLOT GACOR yang sudah pasti menang setiap harinya dan bisa menjadikan bandar ini sebagai patokan untuk mendapatkan penghasilan tambahan yang efisien dan juga sesuatu hal yang fix setiap hari nya. Kami juga mendapatkan julukan sebagai Number #1 website bocor yang berarti terus memberikan member uang asli dan jackpot setiap hari nya, tidak lupa bocor itu juga bisa diartikan dalam bentuk berbagi promosi untuk para official member yang terus setia bermain bersama dengan kami. Berbagai provider Game terus bertambah banyak setiap harinya dan terus melakukan support untuk membuat para official member terus bisa menang dan terus maxwin dalam bentuk apapun maka itu langsung untuk feel free to try yourself, play with SLOT GACOR now or never !
    • SLOT 1000 : SLOT1000 DEPOSIT 1000 VIA DANA - SLOT 1000 VIA QRIS - SLOT DEPOSIT QRIS 1000 - SLOT DEPO 1K - SLOT 1000 BET KECIL KLIK DISINI DAFTAR DISINI SLOT VVIP << KLIK DISINI DAFTAR DISINI SLOT VVIP << KLIK DISINI DAFTAR DISINI SLOT VVIP << KLIK DISINI DAFTAR DISINI SLOT VVIP << SITUS SLOT GACOR 88 MAXWIN X500 HARI INI TERBAIK DAN TERPERCAYA GAMPANG MENANG Dunia Game gacor terus bertambah besar seiring berjalannya waktu, dan sudah tentu dunia itu terus berkembang serta merta bersamaan dengan berkembangnya SLOT GACOR sebagai website number #1 yang pernah ada dan tidak pernah mengecewakan sekalipun. Dengan banyaknya member yang sudah mempercayakan untuk terus menghasilkan uang bersama dengan SLOT GACOR pastinya mereka sudah percaya untuk bermain Game online bersama dengan kami dengan banyaknya testimoni yang sudah membuktikan betapa seringnya member mendapatkan jackpot besar yang bisa mencapai ratusan juta rupiah. Best online Game website that give you more money everyday, itu lah slogan yang tepat untuk bermain bersama SLOT GACOR yang sudah pasti menang setiap harinya dan bisa menjadikan bandar ini sebagai patokan untuk mendapatkan penghasilan tambahan yang efisien dan juga sesuatu hal yang fix setiap hari nya. Kami juga mendapatkan julukan sebagai Number #1 website bocor yang berarti terus memberikan member uang asli dan jackpot setiap hari nya, tidak lupa bocor itu juga bisa diartikan dalam bentuk berbagi promosi untuk para official member yang terus setia bermain bersama dengan kami. Berbagai provider Game terus bertambah banyak setiap harinya dan terus melakukan support untuk membuat para official member terus bisa menang dan terus maxwin dalam bentuk apapun maka itu langsung untuk feel free to try yourself, play with SLOT GACOR now or never !
    • SLOT DEMO PRINCESS 1000 : DEMO SLOT STARLIGHT PRINCESS x 1000 RUPIAH GRATIS TANPA DEPOSIT KLIK DISINI DAFTAR DISINI SLOT VVIP << KLIK DISINI DAFTAR DISINI SLOT VVIP << KLIK DISINI DAFTAR DISINI SLOT VVIP << KLIK DISINI DAFTAR DISINI SLOT VVIP << SITUS SLOT GACOR 88 MAXWIN X500 HARI INI TERBAIK DAN TERPERCAYA GAMPANG MENANG Dunia Game gacor terus bertambah besar seiring berjalannya waktu, dan sudah tentu dunia itu terus berkembang serta merta bersamaan dengan berkembangnya SLOT GACOR sebagai website number #1 yang pernah ada dan tidak pernah mengecewakan sekalipun. Dengan banyaknya member yang sudah mempercayakan untuk terus menghasilkan uang bersama dengan SLOT GACOR pastinya mereka sudah percaya untuk bermain Game online bersama dengan kami dengan banyaknya testimoni yang sudah membuktikan betapa seringnya member mendapatkan jackpot besar yang bisa mencapai ratusan juta rupiah. Best online Game website that give you more money everyday, itu lah slogan yang tepat untuk bermain bersama SLOT GACOR yang sudah pasti menang setiap harinya dan bisa menjadikan bandar ini sebagai patokan untuk mendapatkan penghasilan tambahan yang efisien dan juga sesuatu hal yang fix setiap hari nya. Kami juga mendapatkan julukan sebagai Number #1 website bocor yang berarti terus memberikan member uang asli dan jackpot setiap hari nya, tidak lupa bocor itu juga bisa diartikan dalam bentuk berbagi promosi untuk para official member yang terus setia bermain bersama dengan kami. Berbagai provider Game terus bertambah banyak setiap harinya dan terus melakukan support untuk membuat para official member terus bisa menang dan terus maxwin dalam bentuk apapun maka itu langsung untuk feel free to try yourself, play with SLOT GACOR now or never !
    • FREEBET SLOT : SLOT FREEBET TANPA DEPOSIT FREECHIP 20K 30K 50K TO KECIL RENDAH x2 x3 x4 x5 - SLOT GRATIS TANPA DEPOSIT KLIK DISINI DAFTAR DISINI SLOT VVIP << KLIK DISINI DAFTAR DISINI SLOT VVIP << KLIK DISINI DAFTAR DISINI SLOT VVIP << KLIK DISINI DAFTAR DISINI SLOT VVIP << SITUS SLOT GACOR 88 MAXWIN X500 HARI INI TERBAIK DAN TERPERCAYA GAMPANG MENANG Dunia Game gacor terus bertambah besar seiring berjalannya waktu, dan sudah tentu dunia itu terus berkembang serta merta bersamaan dengan berkembangnya SLOT GACOR sebagai website number #1 yang pernah ada dan tidak pernah mengecewakan sekalipun. Dengan banyaknya member yang sudah mempercayakan untuk terus menghasilkan uang bersama dengan SLOT GACOR pastinya mereka sudah percaya untuk bermain Game online bersama dengan kami dengan banyaknya testimoni yang sudah membuktikan betapa seringnya member mendapatkan jackpot besar yang bisa mencapai ratusan juta rupiah. Best online Game website that give you more money everyday, itu lah slogan yang tepat untuk bermain bersama SLOT GACOR yang sudah pasti menang setiap harinya dan bisa menjadikan bandar ini sebagai patokan untuk mendapatkan penghasilan tambahan yang efisien dan juga sesuatu hal yang fix setiap hari nya. Kami juga mendapatkan julukan sebagai Number #1 website bocor yang berarti terus memberikan member uang asli dan jackpot setiap hari nya, tidak lupa bocor itu juga bisa diartikan dalam bentuk berbagi promosi untuk para official member yang terus setia bermain bersama dengan kami. Berbagai provider Game terus bertambah banyak setiap harinya dan terus melakukan support untuk membuat para official member terus bisa menang dan terus maxwin dalam bentuk apapun maka itu langsung untuk feel free to try yourself, play with SLOT GACOR now or never !
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.