1.12.2 Probleme de texture plante



  • Bonsoir,
    J'ai créer une plante, elle fonctionne visiblement bien, hors mis la texture. Je n'ai pas trouvé d'où venais le soucis...

    La class de la plant

    package net.fightmc.mod.blocks;
    
    import net.fightmc.mod.Fightmc;
    import net.fightmc.mod.init.ItemsMod;
    import net.minecraft.block.BlockCrops;
    import net.minecraft.block.SoundType;
    import net.minecraft.block.properties.PropertyInteger;
    import net.minecraft.block.state.IBlockState;
    import net.minecraft.entity.item.EntityItem;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemStack;
    import net.minecraft.util.EnumFacing;
    import net.minecraft.util.EnumHand;
    import net.minecraft.util.math.AxisAlignedBB;
    import net.minecraft.util.math.BlockPos;
    import net.minecraft.world.IBlockAccess;
    import net.minecraft.world.World;
    
    public class drogue_plant extends BlockCrops {
        
    	public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 7);
    	
        private static final AxisAlignedBB[] drogue = new AxisAlignedBB[] {new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.125D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.25D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.375D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.5D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.625D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.75D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.875D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D)};
    	public drogue_plant(String name)
    	{
    		setUnlocalizedName(name);
    		setRegistryName(name);
    		setCreativeTab(Fightmc.fightmctab);
    		setSoundType(SoundType.PLANT);
    		setDefaultState(this.blockState.getBaseState().withProperty(this.getAgeProperty(), Integer.valueOf(0)));
    	}
    	
    	public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
    	{
    		if(!worldIn.isRemote)
    		{
    			if(this.isMaxAge(state))
    			{
    				worldIn.spawnEntity(new EntityItem(worldIn, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(ItemsMod.drogue, 1)));
    				worldIn.setBlockState(pos, this.withAge(1));
    				return true;
    			}
    		}
    		
    		return false;
    	}
    	
    	@Override
    	protected Item getSeed()
    	{
    		return ItemsMod.drogue_seeds;
    	}
    	
    	@Override
    	protected Item getCrop()
    	{
    		return ItemsMod.drogue;
    	}
    	
    	@Override
    	public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
    		return drogue[((Integer)state.getValue(this.getAgeProperty())).intValue()];
    	}
    	
    	public int getMaxAge()
        {
            return 7;
        }
    }
    
    

    Le blockstate de la plante

    {
        "variants": {
            "age=0": { "model": "fightmc:drogue_plant0" },
            "age=1": { "model": "fightmc:drogue_plant1" },
            "age=2": { "model": "fightmc:drogue_plant2" },
            "age=3": { "model": "fightmc:drogue_plant3" },
            "age=4": { "model": "fightmc:drogue_plant4" },
            "age=5": { "model": "fightmc:drogue_plant5" },
            "age=6": { "model": "fightmc:drogue_plant6" },
            "age=7": { "model": "fightmc:drogue_plant7" }
        }
    }
    

    Les models block

    {
        "parent": "block/crop",
        "textures": {
            "crop": "fightmc:blocks/drogue_plant_stage_0"
        }
    }
    

    Et la texture a le nom "drogue_plant_stage_0"
    ( juste le nombre varie selon le stage )



  • Bonjour, regarde du coté de TextureStitchEvent.Pre ( Client Side proxy ! ) je pense que ton souci viens simplement de là car étant une texture "importer" et non enregistrer dans le code il faut donc la déclarer coté client :
    event.getMap().registerSprite()


Log in to reply