[1.7.10] Crash lorsque je change la metadata d'une tile entity à la main



  • Bonjour, j'aimerais savoir pourquoi je crash lorsque je clique sur la tile entity avec la main.

    public class GhostBlock extends Block {
    	
    	
    
    	protected GhostBlock(Material block) {
    		super(block);
    		
    	}
        
        @Override
        public TileEntity createTileEntity(World world, int metadata)
        {
        	if(metadata == 1) {   		
        		return new TileEntityTutoriel();
        	}else if(metadata == 2) {
        		return new TileEntityTutoriel2();
        	}else if(metadata == 3) {
        		return new TileEntityTutoriel3();
        	}else if(metadata == 4) {
        		return new TileEntityTutoriel4();
        	}
        	
        	return null;
        }
     
        @Override
        public boolean hasTileEntity(int metadata)
        {
        	if(metadata <= 4) {
            return true;
        	}
        	return false;
        }
    	
    	
        public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
        {
            return null;
        }
        
        public boolean isOpaqueCube()
        {
        	
            return false;
        }
        
        public boolean renderAsNormalBlock()
        {
            return false;
        }
        
        
        @Override
        public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float p_149727_7_, float p_149727_8_, float p_149727_9_) {
        	
        	if(!world.isRemote) {
        		if(player.inventory.getCurrentItem().getItem() != null && player.inventory.getCurrentItem().getItem() == ItemMod.ghostTool) {
        			
        			int test = world.getBlockMetadata(x, y, z);
        	    	String m;
        	    	
    	    		if(world.getBlockMetadata(x, y, z) == 0) {
    	    		world.setBlockMetadataWithNotify(x, y, z, 1, 4);
    	    		 m = String.valueOf(world.getBlockMetadata(x, y, z));
    	    		player.addChatComponentMessage(new ChatComponentText(m));
    	    			return true;
    	    		
    	    		}else if(world.getBlockMetadata(x, y, z) == 1) {
    	    			world.setBlockMetadataWithNotify(x, y, z, 2, 4);
    	    			 m = String.valueOf(world.getBlockMetadata(x, y, z));
    	    			player.addChatComponentMessage(new ChatComponentText(m));
    	    			return true;
    	    		
    	    		}else if(world.getBlockMetadata(x, y, z) == 2){
    	    			world.setBlockMetadataWithNotify(x, y, z, 3, 4);
    	    			 m = String.valueOf(world.getBlockMetadata(x, y, z));
    	    			player.addChatComponentMessage(new ChatComponentText(m));
    	    			return true;
    	    		
    	    		}else if(world.getBlockMetadata(x, y, z) == 3) {
    	    			world.setBlockMetadataWithNotify(x, y, z, 4, 4);
    	    			 m = String.valueOf(world.getBlockMetadata(x, y, z));
    	    			player.addChatComponentMessage(new ChatComponentText(m));
    	    			return true;
    	    		
    	    		}else if(world.getBlockMetadata(x, y, z) == 4) {
    	    			world.setBlockMetadataWithNotify(x, y, z, 1, 4);
    	    			m = String.valueOf(world.getBlockMetadata(x, y, z));
    	   			 	player.addChatComponentMessage(new ChatComponentText(m));
    	   			 	return true;
        		}
    	    		return false;	
    		}
        		return false;	
        }
        	return false;	
       }
    }
    

    Merci de votre aide.



  • Alors...Les logs aiderait énormement


Log in to reply